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

Re: Could this be done simpler?

From
Junio C Hamano <gitster@pobox.com>
Date
Jun 25, 2009, 17:25 UTC
Message-ID
<7v3a9ogr8f.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4A43A6B3.5020407@gmx.de>
Matthias Andree <matthias.andree@gmx.de> writes:
> Could we ditch the current git-pull --append description? Can then please
> somebody rewrite this paragraph? This somebody must have completely understood
Show 7 quoted lines
> (1) what this feature is good for (practically speaking)
>
> (2) how it works (technically speaking, to provide reference information)
>
> That would be much more useful, and the use would last longer :-)
>
> I don't dare ask Junio directly.

But if you run blame and mailing list archive search, you would discover that "fetch --append" was my invention. After all, the entire Octopus idea originates from me at 211232b (Octopus merge of the following five patches., 2005-05-05). It is interesting to realize that it was actually a Pentapus made on the day of 5/5/5 ;-)

I thought I was going to take blame on the incomprehensive documentation and pass it on to me being non-native speaker/writer of English, but the situation is bit funny. Documentation/fetch-options.txt says this:

    -a::
    --append::
            Append ref names and object names of fetched refs to the
            existing contents of `.git/FETCH_HEAD`.  Without this
            option old data in `.git/FETCH_HEAD` will be overwritten.
Perhaps there has a cut&paste error?  I haven't looked.
Now answers to (1) and (2).
 (1) The feature was designed exactly for the use case Linus described.
 (2) "git fetch" leaves list of <commit object, repo, branch, flag> for
     each ref fetched from repository in .git/FETCH_HEAD, where flag tells
     if it is meant for merging.  "git pull" runs "git fetch", reads from
     this file to learn which ones to pass to "git merge".  The
     information also is given to "git fmt-merge-msg" to come up with the
     message.
     Usually "git fetch" first empties the existing contents of the file
     and stores the list of refs it fetched.  With --append, it doesn't
     empty the file; refs fetched by the previous invocation of "git
     fetch" will be kept and the refs it fetched are appenede.
     So:
	$ git fetch one a
        $ git fetch --append two b
        $ git pull --apend three c
     will end up having all the three refs from different repositories in
     .git/FETCH_HEAD.  I.e.
	branch a, from repo one, to be merged
	branch b, from repo two, to be merged
	branch c, from repo three, to be merged
     when "git fetch" run by the the last "git pull" returns.  "git pull"
     reads the file and learn what to give to "git fmt-merge-msg" (to come
     up with the message for the merge commit) and "git merge" (to create
     the merge commit).
Previous: Matthias AndreeNext: Matthias Andree
Message 5 of 15 in “Could this be done simpler?”
  1. Linus TorvaldsJun 24, 2009
  2. Junio C HamanoJun 25, 2009
  3. Randal L. SchwartzJun 25, 2009
  4. Matthias AndreeJun 25, 2009
  5. Junio C HamanoJun 25, 2009
  6. Matthias AndreeJun 25, 2009
  7. Junio C HamanoJun 27, 2009
  8. Junio C HamanoJun 25, 2009
  9. Michael J GruberJun 25, 2009
  10. Christian CouderJun 25, 2009
  11. Christian CouderJun 25, 2009
  12. Junio C HamanoJun 25, 2009
  13. Linus TorvaldsJun 25, 2009
  14. Junio C HamanoJun 25, 2009
  15. Christian CouderJun 25, 2009

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.