Git and Project Hygiene

Version control for code, prompts and eval sets, plus the habits that keep secrets like API keys out of your repository.

Beginner · about 6 hours · difficulty 1/5

Git is how you keep a history of your work and collaborate. In AI projects it matters even more, because prompts, eval datasets and configuration are code: a one-word prompt change can alter behaviour across thousands of requests, and you want to know exactly when and why it changed.

Essentials

  • Daily workflow: git status, add, commit, push, pull, meaningful commit messages.
  • Branches and pull requests: work on a branch, open a PR, review diffs, merge.
  • .gitignore: exclude virtual environments, node_modules, large model files and datasets.
  • Secrets: API keys belong in environment variables or a .env file that is ignored, never in commits. Leaked model keys get abused within minutes and can run up large bills.
  • Large files: model weights and big datasets do not belong in normal Git; use Git LFS, object storage or a dataset hub.

Pitfalls

If you commit a key by accident, deleting it in the next commit is not enough; it is still in history. Revoke the key immediately and create a new one.

Good enough to move on

You can create a repo, work on a feature branch, open a pull request, and your repo contains a .env.example but never a real key.

Key concepts

  • Commit, push, pull
  • Branches and pull requests
  • .gitignore and .env files: Keep keys out of history
  • Resolving merge conflicts
  • Git LFS for large files
  • Secret scanning

Mini project

Put your Python or TypeScript script from the previous topic in a GitHub repo with a README, a .gitignore, a .env.example, and at least one merged pull request.

Check yourself

You pushed a commit containing an API key and then deleted it in the next commit. Is the key safe? What must you do?

Free resources