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

Re: Question about "branch.<name>.merge"

From
Junio C Hamano <gitster@pobox.com>
Date
Mar 18, 2011, 21:13 UTC
Message-ID
<7vei64w2sa.fsf@alter.siamese.dyndns.org>
In-Reply-To
<AANLkTin-96TK_8MjAM7MB4CCyZ0ZSvD=ZanaYWLiXsvC@mail.gmail.com>
Josh Ralburton <josh.ralburton@gmail.com> writes:
Show 12 quoted lines
> This is a typical section from a .git config file:
>
> [remote "origin"]
>     fetch = +refs/heads/*:refs/remotes/origin/*
>     url = git://git.kernel.org/pub/scm/git/git.git
> [branch "master"]
>     remote = origin
>     merge = refs/heads/master
>
> I am curious why "branch.master.merge=refs/heads/master"  was
> implemented to refer to the remote branch (refs/heads/master) rather
> than the local branch (refs/remotes/origin/master).

Because conceptually you are merging with the refs/heads/master branch that exists at the "origin" repository, not merging with a remote tracking branch that the "origin" repository may have to track its upstream.

It is immaterial that you happen to have a copy of it at your own remote tracking branch (i.e. refs/remotes/origin/master). If you don't need tracking branches, you can even do something like this:

	[remote "origin"]
                url = git://...there
        [branch "master"]
		remote = origin
                merge = refs/heads/master

Notice that you are telling git not to create any remote tracking branches with this configuration.

Previous: Josh Ralburton
Message 2 of 2 in “Question about "branch.<name>.merge"”
  1. Josh RalburtonMar 18, 2011
  2. Junio C HamanoMar 18, 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.