feat: add --base flag for branch comparison diffs - #1
Open
star-gusto wants to merge 1 commit into
Open
Conversation
Add `-b, --base <ref>` CLI option that compares HEAD against a base ref (e.g. main, origin/main, a commit SHA) using `git diff <base>...HEAD`. Without --base, behavior is unchanged (shows working tree changes). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
|
@Shugar If you could take a look at this PR when you can, I'd appreciate it! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What Is This Change
Adds a
-b, --base <ref>CLI option that shows the diff between HEAD and a base ref (e.g.main,origin/main, a commit SHA) usinggit diff <base>...HEAD, rendered in Diffly's GitHub-like browser UI.Without
--base, behavior is unchanged -- Diffly shows working tree changes (staged, unstaged, untracked) as before.Why Is This Change Being Made
Currently Diffly only shows uncommitted working tree changes. Once changes are committed, there's nothing to display. This makes Diffly less useful for the common workflow of reviewing a feature branch's full diff before opening a PR.
The
--baseflag fills that gap by letting users view committed branch diffs in Diffly's split-view UI -- the same way they'd see them on GitHub, but locally and instantly.Tests
Tested manually against a real feature branch, affecting 9 files, in a large Rails monorepo:
diffly --base maincorrectly shows 9 changed files with full split-view diffs/api/diffresponse includesbasefield identifying the ref--base, existing behavior (working tree changes) is preservedsimple-giterror message-p) works correctly alongside--baseReferences
.option()docsgit diff <base>...HEAD(three-dot) semantics