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

Re: [PATCH] Allow multiple merges to invalid HEAD

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 3, 2011, 07:07 UTC
Message-ID
<7vlizrg6ef.fsf@alter.siamese.dyndns.org>
In-Reply-To
<1301813216-19507-1-git-send-email-tnachen@gmail.com>
Timothy Chen <tnachen@gmail.com> writes:
> Subject: Re: [PATCH] Allow multiple merges to invalid HEAD

I thought somebody already suggested to reword "invalid HEAD" to something more sensible, like "unborn branch", but I may be misremembering things...

Show 7 quoted lines
> Currently git merge only allows one branch when current HEAD
> is not yet pointing to a valid commit.
>
> This patch will allow multiple branches to be passed in,
> and first updates current HEAD to the first branch's head then subsequently
> merge the rest of the branches.
> ---
Missing sign-off.
What's the point of being able to do this in the first place?

The _only_ reason "git pull $there $branch" into an unborn branch exists is because it feels like

	$ git clone $there $directory
could be broken down as this command sequence:
	$ mkdir $directory
        $ cd $directory
        $ git init
        $ git remote add origin $there
	$ git fetch
        $ git pull $there ;# or "git merge origin/master"

And all the above steps actually do work, except for the last step and that is why we added the "pull into emptiness" hack.

Even though it does a very different thing at the mechanical level, having the hack helps these two sequences (a single "clone" vs the "init/remote add/fetch/merge") that are conceptually similar to behave the same.

I however don't think of a halfway sane rationale similar to why we have "merge one into emptiness" to justify this patch. It very much feels like "because I can make things more complex", not "because this is an often desired missing feature that is a major pain point".

Previous: Timothy ChenNext: Jonathan Nieder
Message 2 of 6 in “Allow multiple merges to invalid HEAD”
  1. Allow multiple merges to invalid HEADTimothy Chen, Apr 3, 2011
  2. Junio C HamanoApr 3, 2011
  3. Jonathan NiederApr 3, 2011
  4. Junio C HamanoApr 3, 2011
  5. Jonathan NiederApr 3, 2011
  6. Timothy ChenApr 5, 2011

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.