08 — Commits and history
A commit is one saved step: what changed, who changed it, when, and why.
Writing a good message
add VLAN configuration notes
fix wrong gateway address in readme
remove unused packet capture
- One line, present tense, no full stop.
- Say what the change does, not "update" or "fix stuff".
- Longer explanation? Put it in the description box below the summary.
Committing well
- One idea per commit. Two unrelated changes are two commits.
- Commit often. Small steps are easy to review and easy to undo.
- Never commit passwords, keys or tokens. Removing them later does not remove them from history — you have to change the secret itself.
Reading history
| Where | What you get |
|---|---|
| History button on a folder or file | Every commit that touched it |
| A commit's page | The full diff: red removed, green added |
| Blame on a file | Which commit last changed each line |
| Activity tab | Contribution graph over time |
Undoing
- One commit was wrong → open the commit, press Revert. This creates a new commit that undoes it; nothing is erased.
- A file was wrong → open its history, view the good version, copy the content back and commit.
- A commit is not pushed yet (working from your computer) →
git commit --amendto fix the last one before sharing it.
Comparing
Add /compare/main...my-branch to a repository URL, or use the Compare button, to see every difference between two branches or tags.