Re: [PATCH] BreakingChanges: say that `git diff X..Y` syntax will be removed in 3.0
- From
Martin von Zweigbergk <martinvonz@google.com>
- Date
- Oct 16, 2025, 16:34 UTC
- Message-ID
- <CAESOdVDbVDwmYOFRAAC07GXaJ871FiPWTx58YMLta7vAWDjgfw@mail.gmail.com>
- In-Reply-To
- <i5lgq7cunzqn2k3puuudzb53efqz6cxev64l6ukwy2kf24dab3@ndymfd2ocit3>
On Wed, 15 Oct 2025 at 18:28, Justin Tobler <jltobler@gmail.com> wrote:
Show 11 quoted lines
> > On 25/10/15 10:07PM, Martin von Zweigbergk via GitGitGadget wrote: > > From: Martin von Zweigbergk <martinvonz@google.com> > > > > The `git diff X..Y` syntax is quite misleading because it looks like > > it shows the diff of the commits in the X..Y range but it actually > > shows the diff from X to Y. > > Personally, I would like to see both the double-dot and triple-dot > notations removed from the diff commands because they are often confused > with the revision range notations.
Oh, I agree. I had forgotten that the triple-dot notation is also accepted.
Show 21 quoted lines
> In my opinion, the double-dot > notation doesn't even have much value as it can be replaced with: > > A..B => A B > A.. => A @ > ..B => @ B > > These alternatives are just as concise. > > > IMO, if that syntax is supported, it > > should show a diff from the merge base of X and Y to Y. I hope Git 3.0 > > is a good time to remove support for the current syntax and > > semantics. Then we can perhaps add the syntax back later with less > > surprising semantics. > > With the existing triple-dot notation, `git diff A...B` is equivalent to > `git diff $(git merge-base A B) B`. I think this is what you are > suggesting about that the double-dot notation should do. As mentioned > earlier, I think both these notations are too easily confused with > revision range notations so I think we should avoid using the dot syntax > for such a shortcut altogether.
FWIW, `jj diff` can diff between two commits with `jj diff --from A --to B`. It can also show the changes in commit A with `jj diff -r A`. You can also show the combined diffs in a range with `jj diff -r A..B` (i.e. `jj diff -r A` is a special case of that). I think that's consistent with the range notation because it's the same set of commits that are considered. But both `git diff A..B` and `git diff A...B` take range expressions and show diffs that don't correspond to those ranges. So I guess I'm saying that I'm not fundamentally opposed to having a way of showing the combined diff in a range, as long as it's consistent.
> > The triple-dot notation is a somewhat convienient shortcut though. If we > wanted to remove it, we would maybe want to replace it some other > functionally equivalent shortcut.
Makes sense. The problem is that there are not many symbols that are available without requiring shell escaping. I don't have a good suggestion.
Show 6 quoted lines
> > All this being said, I've sure there are folks in the wild using these > notations in scripts and changing would cause disruption. Maybe the Git > 3.0 release would indeed be a good time to remove them though. > > -Justin