This may also be an issue of the History Simplification process and / or 
the 'flattening' processes for history linearisation and rebases.

The flattening is a known phenomena and was currently being mentioned on 
the Git List, so I have noted this there. 

There is a technical discussion of flattening in the docs at

Do note the original email title  "Pull is mostly evil" ;-) (whole thread 

Clarifying the " excluding merge commit changes" (or misunderstandings if 
you've there were some..) would be really useful. The existing devs do have 
the 'curse of knowledge' so often can't see the problems.
On Tuesday, February 21, 2023 at 5:29:36 PM UTC Konstantin Khomoutov wrote:

> On Mon, Feb 20, 2023 at 09:27:20PM -0800, 'Samuel Stern' via Git for human 
> beings wrote:
> > This is an *extremely* specific question which I've been trying to get 
> an 
> > answer to for quite a while now, so hopefully someone here knows the 
> answer.
> > 
> > Let's say I am starting from nothing, an empty directory on a server. I 
> > have:
> > 
> > - The URL for a public git repository
> > - Two endpoint SHAs (commits on the same branch)
> > 
> > I want to get the complete diff between those commits *excluding* merge 
> > commit changes, and I want to do this as fast as possible (so much 
> faster 
> > than cloning everything and diffing).
> > 
> > I am able to get almost there with the following sequence:
> > 
> > # Fast clone
> > git clone --verbose --no-checkout --filter=blob:limit=250k 
> --single-branch 
> > --branch=${branch} --depth=${depth} $REPO_URL
> > 
> > # Get a series of patches
> > git log --no-merges --first-parent --patch ${base.sha}..${head.sha}
> > 
> > However I need to get a *single* patch that represents all the changes 
> > combined, not a series of patches from the log.
> Isn't mere
> git diff ${head.sha} ${base.sha}
> is what you're looking for?
> Otherwise, I'm with Philipp in that your statements (rephrased)
> - I want to get a single combined change ("patch") describing the literal
> set of changes between such and such commits.
> - I want changes brought in by merge commits excluded.
> Contradict each other: I could in principle envision some algorithm which
> would try to incrementally produce a diff as in walks a chain of commits 
> and
> tries to ignore the changes introduced by merge commits located in that 
> chain,
> but leaving aside the fact such an algotithm would be very brittle for any
> real-world cases, I simply see no use for it - even a theoretical one.
> You might got trapped by the fact you have found `git log` first in your
> search, and this command traverses all individual commits in the subgraph 
> it's
> told to traverse - including "sidelines" brought in by merge commits.
> Instead, plain old `git diff` does not traverse anything: it takes two 
> states
> of the project and compares them.

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
To view this discussion on the web visit

Reply via email to