Git tracks the history of your code so you can rewind, branch, and collaborate without losing anything. GitHub hosts that history online so teams can work together. Confusing the two is normal: Git is the tool, GitHub is a place that stores Git repositories.
The mental model: snapshots, not diffs
Think of each commit as a labeled snapshot of your entire project. The repository is the album of snapshots. You can return to any snapshot, compare any two, or start a parallel timeline (a branch) to try an idea without endangering the main one.
The daily loop
git status # what changed git add file.py # stage a change git commit -m "Fix login redirect" # snapshot it git push # send snapshots to GitHub git pull # fetch teammates' snapshots
Enter fullscreen mode
Exit fullscreen mode
Ninety percent of professional Git use is this loop. The remaining ten percent is branches, and they are simpler than they look.
Branches and pull requests
A branch is a movable label pointing at a snapshot.…