Key takeaways
- A commit is a snapshot of the project with a message explaining the change.
- Staging (git add) chooses what goes into the next commit.
- Branches let you experiment safely without touching the main version.
The basic workflow#
git init
git status
git add index.html
git commit -m "Add home page"
git log --onelinegit init creates a new repository, git status shows what changed, git add stages changes, and git commit records them permanently. git log shows the history.
Branches for safe experiments#
git branch new-feature
git switch new-featureOn a branch you can change code freely. When you are happy with the result, you merge the branch back into the main version.
Source and further reading
- Pro Git— git-scm.com


