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

Re: FETCH_HEAD question

From
Jay Soffian <jaysoffian@gmail.com>
Date
Feb 17, 2009, 17:14 UTC
Message-ID
<76718490902170914p6258b77ak81318f13757f0dfd@mail.gmail.com>
In-Reply-To
<7vy6w5795h.fsf@gitster.siamese.dyndns.org>
On Tue, Feb 17, 2009 at 3:35 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 32 quoted lines
> Now to something totally useless.
>
> After reading the builtin-merge.c and original git-merge.sh (now in
> contrib/examples) script, I think it could have done something entirely
> different.
>
> It could have done this instead.
>
>        sed -e '/       not-for-merge   /d'
>
> to learn the commits and their human-readable origins, and it could have
> tried to reproduce what "git pull" did when it invoked git-merge using
> that information.  Then you could use this workflow:
>
>        $ git pull <possibly with arguments>
>        ... oops, conflicted and is very messy.
>        ... I tried to resolve, but failed and made the mess even worse.
>        ... Let's start over.
>        $ git reset --hard
>        ... FETCH_HEAD knows which refs are for merging
>        $ git merge FETCH_HEAD
>
> That is, no matter what the arguments were for the initial "git pull",
> what should be merged is recorded in FETCH_HEAD, and that is how you can
> retry the merge without refetching over the network.
>
> But such a change makes FETCH_HEAD different from what it traditionally
> meant, and does that only to "git merge", making the result very
> inconsistent.  For example, "git log ..FETCH_HEAD" will still use the
> object name on the first line, and it won't be a way to convince yourself
> that the changes are sensible and it is Ok to run "git merge FETCH_HEAD"
> anymore.  So I do not think such a change will be an improvement.

Unless dwim_ref() is updated to handle FETCH_HEAD specially, and return not the first SHA1, but the one not marked "not-for-merge". Then the UI would at least be consistent, but this would not be backward compatible.

j.
Previous: Junio C HamanoNext: Johannes Schindelin
Message 8 of 15 in “FETCH_HEAD question”
  1. Jay SoffianFeb 17, 2009
  2. Jay SoffianFeb 17, 2009
  3. Junio C HamanoFeb 17, 2009
  4. Jay SoffianFeb 17, 2009
  5. Junio C HamanoFeb 17, 2009
  6. Jay SoffianFeb 17, 2009
  7. Junio C HamanoFeb 17, 2009
  8. Jay SoffianFeb 17, 2009
  9. Johannes SchindelinFeb 17, 2009
  10. Jay SoffianFeb 17, 2009
  11. PUSH_HEAD, was Re: FETCH_HEAD questionJohannes Schindelin, Feb 17, 2009
  12. Junio C HamanoFeb 17, 2009
  13. Jay SoffianFeb 18, 2009
  14. Johannes SchindelinFeb 18, 2009
  15. Sitaram ChamartyFeb 17, 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.