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

Re: confused about remote branch management

From
RBRoss Boylan <ross@biostat.ucsf.edu>
Date
Jul 24, 2014, 00:24 UTC
Message-ID
<1406161447.29001.235.camel@localhost>
In-Reply-To
<xmqqvbqnab1n.fsf@gitster.dls.corp.google.com>
On Wed, 2014-07-23 at 16:51 -0700, Junio C Hamano wrote:
Show 10 quoted lines
> Ross Boylan <ross@biostat.ucsf.edu> writes:
> 
> >> Either
> >> 
> >> 	git fetch origin master:refs/remotes/origin/master
> > Great; that works.
> > Is that procedure supposed to be the usual way I track upstream in this
> > (1.7) version of git?  It seems arcane.
> 
> No, and no.  
Good.  How should I handle getting updates from origin?
Show 28 quoted lines
> The command is designed so that most of the time you
> can just say "git fetch<ENTER>" without anything extra, which will
> let the configured remote.*.fetch to kick in as the default refspec
> to slurp updates to all the branches.  This is because the branches
> of a single project are supposed to be related, and a single "git
> fetch" goes over a single network connection, establishment of which
> is expected to be a large overhead.  Letting a single invocation of
> "fetch" to slurp updates to _all_ the branches is supposed not to be
> too much overhead over grabbing updates to everything (let alone
> invoking a "git fetch" per each individual branch), and is the
> normal mode of operation.
> 
> A single-shot "git fetch origin master" to explicitly decline
> following of everything other than 'master' *is* the special case.
> 
> And it was a very conscious design decision not to molest the remote
> tracking branch when this kind of explicit command line request is
> made, so that you do not lose track of what commit you _saw_ before
> you ran the command.  That way "git log origin/master..FETCH_HEAD"
> can be used to inspect what got changed since you fetched last time.
> 
> Over the years, with reflogs enabled for everybody, preserving the
> remote tracking branches when the user does not explicitly ask to
> store the result has become much less important.  For this reason,
> modern Git applies, when it sees "git fetch origin master", the
> configured remote.*.fetch as refmap to map the name "master",
> i.e. the only branch you are fetching, to the remote tracking branch
> you use to store the result, i.e. "refs/remotes/origin/master".

For this case I think "get fetch" will attempt to retrieve from the "personal" remote.

Will "get fetch origin" (with no other arguments) update all the branches in origin, updating the remote tracking branches, particularly in git 1.7?

When I tried "git fetch origin" nothing happened (it returned immediately with no messages and git branch -v -a showed the same heads as before). It's quite possible none of the other branches have changed since I last got them, so I don't think the exercise proves much.

Ross
Previous: Junio C HamanoNext: Kevin
Message 7 of 9 in “confused about remote branch management”
  1. Ross BoylanJul 23, 2014
  2. Chris PackhamJul 23, 2014
  3. Ross BoylanJul 23, 2014
  4. Junio C HamanoJul 23, 2014
  5. Ross BoylanJul 23, 2014
  6. Junio C HamanoJul 23, 2014
  7. Ross BoylanJul 24, 2014
  8. KevinJul 23, 2014
  9. Ross BoylanJul 23, 2014

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.