You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature idea: diff a branch/worktree against a base branch (merge-base) via the compare view #2996
Bind v to open the existing compare-commits view for a branch (or worktree) against a base branch, diffed from their merge-base (three-dot, base...HEAD) so it shows only that branch's own changes — a PR-style "what did this branch change" review. No new popup or tab: it reuses CompareCommitsPopup unchanged.
Motivation
The Branches popup already has Shift+C ("Compare"), but that's a tip-to-tip (two-dot) diff of the selected branch vs HEAD, so it includes commits the base gained after the fork point (and reads in the opposite direction). A merge-base diff answers the "what has my branch changed relative to X" question directly, the way a PR diff reads.
What it adds
One key, v (diff_base); the base varies by context, always merge-base:
Global v — current branch (HEAD) vs the repo's base branch (auto-resolved: main/master/origin/*).
Branches popup v ("Diff since branch-point") — current branch vs the highlighted branch (an arbitrary base). Sits next to the existing Shift+C ("Compare"); the distinct labels keep the two clear.
Worktrees popup v — the selected worktree's branch vs the base branch, without switching into it.
Backend is a small asyncgitbranch_diff module (merge_base, resolve_base_branch, diff_range_vs_base, diff_range_vs_ref). The triggers just resolve two commit ids and push the existing OpenPopup(CompareCommits(...)).
Worktree touch-point (heads-up)
The Worktrees-popup v is built on a worktree-management popup that isn't upstream yet — proposed separately in #2995. So that surface can't land independently: a PR against current master would be global v + Branches-popup v only, with the worktree surface following if/after #2995 lands.
Questions
Is this something you'd want as a PR?
If so, preferred scope — just the global "diff current branch vs main" v, or also the Branches-popup v (given the Shift+C overlap)?
Any preference on the key (v) or the command naming?
Before this gets too stale, I've recently had a need for the functionality that @stevenpollack has started. It works fairly well but was still missing some functionality that I went ahead and added. Mind you this list is based on my own needs:
sibling approach for worktree filesystem organization {repo_name}.{worktree_name} (inspiration from worktrunk cli)
when deleting a worktree, optionally remove the branch of the same name
create worktree from existing branch & check it out
after switching worktrees, upon exiting gitui, have the terminal cd to the directory associated with the worktree
Currently, I've worked off a fork of a fork, and its been working GREAT, but happy to contribute directly if it's useful. Code found here
Open to feedback or any other ideas for getting worktrees into gitui!
Activity
gclarkjr5 commentedon Nov 17, 2026
Before this gets too stale, I've recently had a need for the functionality that @stevenpollack has started. It works fairly well but was still missing some functionality that I went ahead and added. Mind you this list is based on my own needs:
{repo_name}.{worktree_name}(inspiration from worktrunk cli)cdto the directory associated with the worktreeCurrently, I've worked off a fork of a fork, and its been working GREAT, but happy to contribute directly if it's useful. Code found here
Open to feedback or any other ideas for getting worktrees into gitui!