git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Suggestion: git fetch <remote> <branch> to update remote-tracking branch
@ 2012-03-05 16:45 Antony Male
  2012-03-05 17:42 ` Junio C Hamano
  0 siblings, 1 reply; 3+ messages in thread
From: Antony Male @ 2012-03-05 16:45 UTC (permalink / raw)
  To: git

Hi all,

First off, this is a very tentative suggestion.  It would result in a 
slight change to established behaviour, which I'm well aware could be a 
Bad Thing(tm).  However, I was encouraged by a number of people on #git 
to make it anyway, so here goes.

The issue is this: the two-argument form of 'git fetch' (e.g. 'git fetch 
<remote> <branch>') fetches the named ref into FETCH_HEAD, but does not 
update the related remote-tracking branch.  While this is intuitive 
behaviour when <remote> is a URL, we see a lot of git beginners 
attempting to run 'git fetch origin branch' and being confused when 
origin/branch isn't updated.  Similarly, 'git pull origin master' will, 
in a simple case, fast-forward the local master but not origin/master.

My suggestion, therefore, is to modify the behaviour of 'git fetch' such 
that 'git fetch <remote> <branch>' will update both FETCH_HEAD and the 
relevant remote-tracking branch, when <remote> is the name of a 
configured remote and <branch> contains only the src part of the 
refspec.  The behaviour would not change when <remote> was a URL or 
path, or when a <src>:<dst> refspec was used.

Of course, it would be desirable to be able to replicate the existing 
behaviour.  Currently, I don't have any good suggestions, although there 
may be an existing trick I'm missing.  Possible suggestions might be 
'git fetch <remote> <branch>:FETCH_HEAD' or 'git fetch <remote> 
<branch>:', or maybe a new flag?

What do people think?

Many thanks for your time and consideration,
Antony Male

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-03-06  8:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-05 16:45 Suggestion: git fetch <remote> <branch> to update remote-tracking branch Antony Male
2012-03-05 17:42 ` Junio C Hamano
2012-03-06  8:59   ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).