Compare commits and act on a selection
Select two commits with Ctrl (⌘ on a Mac) held down and choose Compare These Two Commits to see every file that differs. A selection of several commits has its own actions: copy the SHAs, cherry-pick, revert, squash or create a patch.
Works in GitTree Free: every local Git feature, once you are signed in.
On this page
Before you start
- A repository is open.
Where to find it
- Select commits with Ctrl-click (⌘-click on a Mac); Shift-click selects a range. Right-click the selection for its actions.
- Right-click one commit: Compare › Compare with Working Directory or Compare with HEAD….
| Action | macOS | Windows and Linux |
|---|---|---|
| Find a commit first | ⌘F | Ctrl+F |
Steps
Select two commits
Click the first, then Ctrl-click (⌘-click on a Mac) the second. The inspector says 2 commits selected.
Compare them
Right-click the selection and choose Compare These Two Commits. The list shows Files that differ; select one to see its diff.
Swap the sides if needed
Swap Sides shows the change in the other direction.
Expected result
You see exactly what changed between the two commits, file by file.
What a selection can do
| Action | Needs |
|---|---|
| Copy SHAs | Any selection. |
| Compare These Two Commits | Exactly two commits. |
| Cherry-Pick Commits and Revert Commits | One or more commits (cherry-pick and revert). |
| Squash Commits… | Two or more in one unbroken line, without a merge (squash commits). |
| Create Patch from Commits… | One or more commits. |
If something goes wrong
An action is greyed out: “Select exactly two commits.”
Each action names what it needs. Change the selection to match, such as two commits to compare.
“The selected commits are not one unbroken line.”
Squashing needs consecutive commits. Select a range with Shift-click instead.
Questions
How do I see what I changed since a commit?
Right-click the commit and choose Compare with Working Directory: it lists every file your working folder changes compared with that commit.