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

Question regarding git fetch

From
TLTom Lambda <tom.lambda@gmail.com>
Date
Aug 27, 2009, 15:30 UTC
Message-ID
<1251387045053-3527289.post@n2.nabble.com>

I noticed that git-fetch seems smarter when it is run without a <refspec> argument than when one specifies a branch name. I use a simple setup where a remote central repository is defined when it is cloned the first time (clone -o central ...). This leads to these default parameters:

remote.central.fetch=+refs/heads/*:refs/remotes/central/* branch.master.remote=central branch.master.merge=refs/heads/master

When I use "git fetch central" each branch in central's refs/heads/ is automatically fetched to my refs/remotes/central/ as expected.

What was a little bit surprising to me is that running "git fetch central master" does not update refs/remotes/central/master but simply updates FETCH_HEAD.

I read the manual and I know that updating FETCH_HEAD is the expected default behavior for git-fetch. However, I really like the fact that git fetch (without <refspec>) knows that ANY branch in refs/heads/ corresponds to refs/remotes/central/. Is there a way to change the configuration to have "git fetch central branch" always updating refs/remotes/central/branch whatever the specified branch.

I would prefer not to have to specify the <dst> each time: git fetch central branch:remotes/central/branch

Thank you, Tom

-- 
View this message in context: http://n2.nabble.com/Question-regarding-git-fetch-tp3527289p3527289.html
Sent from the git mailing list archive at Nabble.com.
Next: Avery Pennarun
Message 1 of 17 in “Question regarding git fetch”
  1. Tom LambdaAug 27, 2009
  2. Avery PennarunAug 27, 2009
  3. Eric RaibleAug 27, 2009
  4. Avery PennarunAug 27, 2009
  5. Björn SteinbrinkAug 27, 2009
  6. Avery PennarunAug 27, 2009
  7. Jeff KingAug 27, 2009
  8. Jeff KingAug 27, 2009
  9. Junio C HamanoAug 27, 2009
  10. Jeff KingAug 27, 2009
  11. Jeff KingAug 27, 2009
  12. Avery PennarunAug 27, 2009
  13. Jeff KingAug 27, 2009
  14. Avery PennarunAug 27, 2009
  15. Junio C HamanoAug 27, 2009
  16. Jeff KingAug 27, 2009
  17. Tom LambdaAug 28, 2009

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.