symmetric difference with --left-only vs. range notation
- From
D. Ben Knoble <ben.knoble@gmail.com>
- Date
- Aug 13, 2025, 18:55 UTC
- Message-ID
- <CALnO6CBOWTCd-cREfGYL8DPPd=S-s3Y6s0cgwvBzCJZr6E6hvA@mail.gmail.com>
- In-Reply-To
- <10372e00-3bb1-453a-bb62-332aaa935b24@gmail.com>
On Sun, Aug 10, 2025 at 11:42 AM Phillip Wood <phillip.wood123@gmail.com> wrote:
Show 15 quoted lines
> > Hi Julia > > On 09/08/2025 02:14, Julia Evans via GitGitGadget wrote: > > From: Julia Evans <julia@jvns.ca> > > > > +Here is a more detailed description of what `git rebase <upstream>` does: > > + > > +First, it makes a list of all commits in the current branch that are not in > > +`<upstream>`. This is the same set of commits that would be shown by `git log > > +<upstream>..HEAD`. > > The existing text is not quite accurate here, it should really say `git > log --cherry-pick --right-only <upstream>...HEAD` as we drop any commits > from the branch that have already been cherry-picked to <upstream>.
This reminds me, I've been meaning to ask: is there a meaningful difference between the following 2 commands?
git rev-list --count --left-only @{u}...
git rev-list --count ..@{u}In my estimation, since we're not using --cherry-pick here, the first says "list (count) the commits on upstream but not in HEAD, since the merge-base (which is reachable from both)" while the second says "list (count) the commits on upstream but not in HEAD." Is there ever a situation where those sets aren't the same?
Of course the symmetric difference is not always the same as the range notation, but when we add --left-only [or --right-only, by symmetry ;)], does this collapse to the 2-dot notation?
I've been assuming the latter is more performant, too, but if that's not the case, that's also good to know.