Git Cheat Sheet · Changes
See a file's differences
git diff · git diff --staged
git diff shows line by line what you have changed and not staged yet. To see what will go into the next commit, use git diff --staged. Added lines start with "+", removed lines with "−".
What it does
Shows line by line what changed, compared to the index (unstaged) or the last commit (staged).
A use case
You no longer remember what you touched in a file before staging it.
On the command line
git diff- Unstaged changes, compared with the index.
git diff --staged- Staged changes, compared with the last commit (synonym:
--cached). git diff HEAD- All changes, staged or not.
git diff <commit1> <commit2>- Differences between two commits.
git diff main...<branch>- What the branch has added since it left main.
git diff --stat- Summary: files touched and number of lines.
In Merathon
- Click the file in the right panel: the diff appears in the center.
- Esc goes back to the graph.
Frequently asked questions
Why does git diff show nothing when I changed a file?
The changes are probably already staged: try git diff --staged. An untracked file does not appear in git diff either.
How do I compare two commits in Merathon?
Select two commits in the graph, then right-click to compare them.