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

git fetch documentation problem or bug

From
ABAngelo Borsotti <angelo.borsotti@gmail.com>
Date
Oct 8, 2012, 18:59 UTC
Message-ID
<CAB9Jk9Ac06sfFMGizRq6Ztqd2tKS7BBqGOC891=z4615J3f4hA@mail.gmail.com>
Hello,

git fetch <repository> <refspec> does not create the remote refs in the current (local) repository, as shown by the following script:

git init remote git clone remote local

# populate the remote repository with a commit cd remote touch f1 git add f1 git commit -m A

cd ../local git fetch origin master git branch -avv

No ref is created.
However, if a git fetch origin is executed, the refs are properly created:
git fetch origin
 * [new branch]      master     -> origin/master
  remotes/origin/master 8a9186d A

I have not seen any clue in the documentation that tells the user about this difference. The user may (naively) think that git fetch origin downloads all branches, while git fetch origin <branch> downloads only <branch>, but it is not so. I am wandering if this is a documentation problem or a bug.

-Angelo
Next: Junio C Hamano
Message 1 of 7 in “git fetch documentation problem or bug”
  1. Angelo BorsottiOct 8, 2012
  2. Junio C HamanoOct 8, 2012
  3. Junio C HamanoOct 8, 2012
  4. Junio C HamanoOct 8, 2012
  5. Nguyen Thai Ngoc DuyOct 9, 2012
  6. Drew NorthupOct 21, 2012
  7. Junio C HamanoOct 21, 2012

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.