Commits, staging and history
Not met yet
git keeps a folder's history as a chain of commits. Each commit is a photograph of every staged file plus a message. You edit in the working folder, choose what goes in the next commit with git add, and take the photograph with git commit -m "...". git status, git diff and git log tell you where things are.
Try it
main.py# In a terminal, not in Python: # git init # git add . # git commit -m "First version of the job tracker" # git log --oneline
Output
Press Run and what your program prints shows up here.
Easy to get wrong
- Thinks git commit saves every changed file, without staging.
- Thinks git add is only for brand-new files.