git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: Confusion about diffing branches

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 27, 2007, 17:20 UTC
Message-ID
<7vmywczyfp.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<20070827170504.GH4680@thunk.org>
Theodore Tso <tytso@mit.edu> writes:
Show 9 quoted lines
> The bigger inconsistency is with git-format-patch, which *does* take a
> set of commits, and where "git-format-patch a" does operates on a very
> different set of commits than what what "git-rev-list a" returns.  I
> understand that for backwards compatibility "git-format-patch a" is
> equivalent to "git-format-patch a..HEAD", but what it means is that
> all other ways of specifying sets of commits work with
> git-format-patch, *except* if you want to specify all commits from the
> beginning of time to a particular head (i.e., "git-rev-list a") is
> something that you simply can not possibly do using git-format-patch.
Heh, I really hate when people say this.
If you wanted to, you could:
	$ git format-patch a a
The original syntax
	$ git format-patch upstream
may have been a mistake and maybe
	$ git format-patch ^upstream
or even        
	$ git format-patch --since upstream

might have been better. It is (1) too late to change now, and (2) for too small or perhaps negative a gain.

The reason why I say (2) is because _I_ think it is far more common and frequent to want to get "patches the other guy does not have" than "everything since nothingness up to this point".

Oops.  I think I have a solution.
	$ git format-patch a a
does not do _ROOT_ commit.  So you have to say
	$ git format-patch --root a a

for the above example to work. Why not tweak the option parser so that:

	$ git format-patch --root a

to do what you want? Without --root and with a single positive commit, it can keep doing the traditional "what I did since I forked from that guy's history".

Hmm...
Previous: Theodore TsoNext: Theodore Tso
Message 12 of 14 in “Confusion about diffing branches”
  1. Shawn BohrerAug 26, 2007
  2. Junio C HamanoAug 27, 2007
  3. Shawn BohrerAug 27, 2007
  4. Mike HommeyAug 27, 2007
  5. Junio C HamanoAug 27, 2007
  6. Mike HommeyAug 27, 2007
  7. Francis MoreauAug 27, 2007
  8. Mike HommeyAug 27, 2007
  9. Junio C HamanoAug 27, 2007
  10. Mike HommeyAug 27, 2007
  11. Theodore TsoAug 27, 2007
  12. Junio C HamanoAug 27, 2007
  13. Theodore TsoAug 27, 2007
  14. Jakub NarebskiAug 27, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.