Git Basics
Git is the version control system used by virtually every software project today.
The three areas
Git has three main areas to understand:
- Working tree — your files as they are on disk
- Staging area (index) — changes you've marked to include in the next commit
- Repository — the committed history
Essential commands
git init # start a new repository
git add . # stage all changes
git commit -m "" # commit with a message
git log # view history
git diff # see unstaged changes
Branching
git branch feature # create a branch
git switch feature # switch to it
git merge feature # merge back into main
Branches are cheap in Git — use them freely.