Skip to content

Comparing two branches

The Compare … with entry — on a graph branch pill or a sidebar branch row's native context menu — opens a dedicated dialog that diffs two arbitrary refs directly against each other, independent of what is currently checked out. Either side can be re-picked from the same branch list without closing the dialog, and swapping them is a different diff, not a cosmetic flip.

Comparing two branches shows their real, per-file differences

Pick any two branches and the dialog shows what actually separates them, file by file, with per-file addition and deletion counts — regardless of which branch is checked out. Either side can be re-picked from the same list without closing the dialog, and swapping the sides asks the real question in the other direction rather than flipping the display.

Comparing two branches shows their real, per-file differences

Captured from the running app by this scenario.

Do this

  1. Compare main with feature/diverged

You should see

  • The compare branches dialog is shown
  • The compare branches summary reads 2 files changed
  • The compare branches diff includes the file app.txt
  • The compare branches diff includes the file shared.txt

Swapping sides reverses which branch each change comes from

Diffing "main" against "feature/diverged" or the other way around is not the same question, and the backend has to be asked again — not just have its answer flipped on screen.

Swapping sides reverses which branch each change comes from

Captured from the running app by this scenario.

Do this

  1. Compare main with feature/diverged
  2. Swap the compared sides

You should see

  • The file shared.txt in the compare view shows 1 addition and 0 deletions
  • The file app.txt in the compare view shows 0 additions and 1 deletion
  • The file shared.txt in the compare view shows 0 additions and 1 deletion
  • The file app.txt in the compare view shows 1 addition and 0 deletions

Re-picking a side through the branch picker loads a real diff

Opening the dialog on two identical refs is a safe starting point — no backend call is even made — until one side is re-picked through the dialog's own branch selects, the same control a user would drive by hand.

Re-picking a side through the branch picker loads a real diff

Captured from the running app by this scenario.

Do this

  1. Compare main with main
  2. Pick feature/diverged as the compare head

You should see

  • The compare branches dialog reports the two sides are identical
  • The compare branches diff includes the file shared.txt
  • The compare branches diff includes the file app.txt

This page is generated from apps/e2e/features/compare-branches.feature, the end-to-end test that drives the feature it describes.

MIT licensed · Screenshots exported from the real app by the end-to-end suite.