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

Re: "git pull REMOTE" question

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 22, 2007, 20:29 UTC
Message-ID
<7vmywjia8f.fsf@gitster.siamese.dyndns.org>
In-Reply-To
<1187801063.15321.4.camel@ld0161-tx32>
Jon Loeliger <jdl@freescale.com> writes:
Show 19 quoted lines
> On Wed, 2007-08-22 at 00:11, Junio C Hamano wrote:
> ...
>>  ;; new -- when on "master', and the user says to pull from "usb"
>>  ;; without saying which branch to merge, use '[remote "usb"] url'
>>  ;; and '[remote "usb"] fetch' to decide where to fetch from,
>>  ;; and merge their refs/heads/xprm to our branch.
>>  [branch "master:usb"]
>>  	merge = refs/heads/xprm
>> 
>> The trick in the new syntax is that you cannot have a colon in
>> refname, so there is no way for existing [branch $name] section
>> to crash with the new style definition.
>
> Wasn't there was a brief alternate notion to add a "for <remote>"
> clause and allowing something like this?:
>
>     [branch "master"]
>         merge = refs/heads/xprm for usb
>         merge = refs/heads/stuff for otherremote

Yeah, I remember that one (I do not think nobody implemented it, though). Thanks for reminding.

So...
	[branch "master"]
        	remote = origin
                merge = refs/heads/xprm for usb
                merge = refs/heads/stuff for otherremote
                merge = refs/heads/master
and when you are on your "master", 
	$ git fetch
        $ git pull
goes to "origin" (because you did not even say the remote name).
	$ git fetch usb
        $ git pull usb

goes to "usb". And "git pull" from such a nicknamed remote looks up merge lines with "for nickname" to find the branch(es) to merge. If there is no merge line with "for nickname" for the remote (e.g. "git pull origin" in the above example does not have any), and if there is a merge line without "for nickname", then that line can be used (e.g. "git pull" which is exactly the same as "git pull origin" will use the 'master' branch from the remote).

I think that is much easier to understand and maintain for the end users than the [branch "master:usb"]. The latter is wrong to begin with -- it is not about branch anymore.

Previous: Jon Loeliger
Message 6 of 6 in “"git pull REMOTE" question”
  1. Miles BaderAug 22, 2007
  2. Junio C HamanoAug 22, 2007
  3. Miles BaderAug 22, 2007
  4. Junio C HamanoAug 22, 2007
  5. Jon LoeligerAug 22, 2007
  6. Junio C HamanoAug 22, 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.