Skip to content
Versora

Manual

Inspection

Compare commits, branches and tags

7 min read

On this page

Versora has three ways to compare revisions:

FeatureWhat it's forWhere it appears
Selection diffSee the diff between two commits in the graph, or the combined effect of several consecutive commitsRight panel
Compare with…See which commits one branch has and the other doesn't, and what a merge would bringCentral area
Compare commit with working directorySee what changed on disk since an old commitRight panel

Selection diff in the graph

With two or more commits selected in the graph, the right panel stops showing a single commit and shows the selection diff instead:

  • Two commits: the diff between them, from the oldest to the newest.
  • Consecutive commits (each one is the first parent of the next): the combined diff, from the oldest one's parent to the newest. It's the same as applying all of them at once, as if they were a single commit.
  • Scattered commits: their sum doesn't make a single diff. The panel offers to compare just the ends.

Where to find it

  • Graph: Ctrl+click or Shift+click commits. See Multiple selection.
  • Selection menu (right-click with several commits selected): Compare <oldest> with <newest>, which opens the full comparison directly.

Step by step

  1. Click a commit in the graph and Ctrl+click another one.
  2. The right panel shows Diff between 2 commits, with the from (the oldest) and to (the newest) labels, and the list of changed files.
  3. Click a file to open its diff.
  4. To reverse the diff, use ⇅ Swap sides ("Reverses the diff: from the newest to the oldest").
  5. To also see the commits on each side, click Open comparison ("Opens the full comparison in the center area, with the commits on each side"). It opens on the Files tab of the comparison described in Compare with…, further down.
  6. To leave, use the panel's X ("Clear selection (Esc)") or Esc.

The What to compare picker appears when more than one mode is possible:

OptionWhat it doesWhen it appears
Between the two"The differences from the oldest commit to the newest"Two commits selected
Combined"All the changes of the selected commits together, as if they were a single commit"Consecutive commits
Compare the oldest with the newestButton that compares just the ends of a scattered selectionCommits that aren't in sequence

With three or more consecutive commits, the panel goes straight to the Combined diff of N commits. With two commits, the default is Between the two, and Combined is available if they're consecutive. After Compare the oldest with the newest, the title becomes Diff between the ends of N commits.

Caveats and messages

  • "The selected commits aren't in sequence, so their sum isn't a single diff. Select consecutive commits (Shift+click) or compare just the ends.": the selection has gaps. Use Compare the oldest with the newest or redo the selection with Shift+click.
  • "Both commits have the same files.": there's no difference between them.
  • "(empty)": the "from" side is the empty tree, because the oldest commit in the selection has no parent.

Compare with…

For any two revisions (branch, tag or commit), shows the commits that are in one and not in the other, and the file differences. The typical question is "what enters main if I merge feature/login?", but it also works for comparing two version tags or two commits.

In the comparison, A is the base (where the merge would go) and B is what would be merged. The title says "Compare B with A".

Where to find it

  • A commit's menu: Compare with…
  • Menu of a branch (local or remote) or of a tag: Compare <name> with…
  • Menu of a branch that isn't the current one: What enters <current> when merging <branch>, which opens directly, without asking for the other side.
  • Commit selection menu: Compare <oldest> with <newest>.
  • Selection diff: Open comparison button.
  • Palette (Ctrl+P):
    • "Compare revisions…" ("Commits on one side and not on the other, and the file differences"): asks first for What to compare (B) and then for the other side;
    • "What enters if I merge…" ("Commits from another branch that aren't in <current> yet"): asks only for the branch to merge.

Step by step

  1. Right-click the feature/login branch and choose Compare feature/login with….
  2. In the Compare feature/login with… window, choose the other side (A), for example main:
    • type to filter; the list groups the options into current, branch, remote, tag and revision;
    • use ↑ and ↓ and Enter. Any SHA or git expression, such as HEAD~3, also works: choose Use "<text>";
    • Esc cancels.
  3. The comparison opens in the central area. The header sums it up: "feature/login is 5 ahead and 12 behind main".
  4. On the Commits tab, choose the direction:
    • N commits enter main: "What enters main if you merge feature/login: the commits in feature/login that main doesn't have yet.";
    • Only in main: N commits: "The commits in main that feature/login doesn't have (what would enter feature/login when merging main).".
  5. Choose a commit from the list to see its message and files on the right.
  6. On the Files tab, choose Which differences (table below) and click a file to see the diff.
  7. To swap A and B, click ⇄ ("Swaps A and B: shows what would enter B when merging A").
  8. Use the reload button to read again and the X or Esc to close. The comparison also updates on its own when one of the branches moves (commit, fetch, rebase).
OptionWhat it shows
What the merge brings"The changes in B since the common point (like a merge request diff)". The note says which commit is the common point. It's the default.
Direct difference"Everything that differs between the trees of A and B, on both sides". The note says: "Difference between the trees of A (−) and B (+)."

A file's menu on the Files tab

ItemWhat it does
Bring the version from <B>…Opens Bring file with B's version. Disabled if the file was deleted in B.
Bring the version from <A>…The same, with A's version. Disabled if the file is new in B.
File historyOpens the file history starting from B.
Blame at <B>Opens the file's blame in B.

What Versora does in git

Read only. The queries run at the same time:

bash
git merge-base A B                          # the common point
git rev-list --left-right --count A...B     # how many commits only in A and only in B
git log --date-order -n 500 A..B            # what enters A when merging B
git log --date-order -n 500 B..A            # what only A has
git diff --name-status <merge-base> B       # "What the merge brings"
git diff --name-status A B                  # "Direct difference"

Caveats and messages

  • "Both revisions have the same commits.": A and B point to the same history.
  • "The two revisions have no history in common.": there's no common point. What the merge brings is unavailable; use Direct difference.
  • "main already has every commit in feature/login: the merge wouldn't bring anything.": the branch has already been merged.
  • "Plus N more commits (the list shows the 500 most recent).": each side lists up to 500 commits; the total appears in the summary.
  • "No files differ.": the trees are the same in the chosen mode.
  • "There's no commit named "<text>" in this repository (branch, tag or SHA).": the revision you typed doesn't exist. Check the name.
  • "Available with a branch checked out (not in detached HEAD)": the palette makes "What enters if I merge…" unavailable without a current branch.
  • "The repository has no commits yet": the palette makes the commands unavailable.

Compare commit with working directory

Shows what's different between an old commit and the files on disk today, including the changes not committed yet. It answers "what changed since version 1.4?" without a checkout.

Where to find it

  • A commit's menu: Compare commit with working directory.

Step by step

  1. Right-click the commit (for example the one with the v1.4.0 tag) and choose Compare commit with working directory.
  2. The right panel shows "Comparing <sha> with the working directory" and the count, for example "12 files differ".
  3. Click a file to see the diff. The diff header shows the commit × working directory mode.
  4. To leave, click End comparison.

Caveats and messages

  • "No differences: the working directory matches this commit.": nothing has changed since that commit.

How to undo

None of the three comparisons changes the repository. There's nothing to undo.

The comparisons have no preference of their own and no company policy key.

See also