Skip to content
GitTree
Commit graph

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.

FreeUpdated

Works in GitTree Free: every local Git feature, once you are signed in.

On this page
  1. Before you start
  2. Where to find it
  3. Steps
  4. Expected result
  5. What a selection can do
  6. If something goes wrong
  7. Questions
  8. Related

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….
ActionmacOSWindows and Linux
Find a commit first⌘FCtrl+F

Steps

  1. Select two commits

    Click the first, then Ctrl-click (⌘-click on a Mac) the second. The inspector says 2 commits selected.

  2. Compare them

    Right-click the selection and choose Compare These Two Commits. The list shows Files that differ; select one to see its diff.

  3. 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

Actions on several selected commits
ActionNeeds
Copy SHAsAny selection.
Compare These Two CommitsExactly two commits.
Cherry-Pick Commits and Revert CommitsOne 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.