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

Re: Missing branches after clone

From
Duy Nguyen <pclouds@gmail.com>
Date
May 14, 2019, 10:12 UTC
Message-ID
<CACsJy8AX9Wp3W=d1=ozF9nZXGE1muooMf7fKCtdOOi1g8QRmig@mail.gmail.com>
In-Reply-To
<5CDA8D37020000A100031319@gwsmtp.uni-regensburg.de>

On Tue, May 14, 2019 at 4:42 PM Ulrich Windl <Ulrich.Windl@rz.uni-regensburg.de> wrote:

>
> Hi!
>
> While wondering why some branches are not being displayed by "git branch" in a cloned repository, I was reading the obvious man pages (man git-branch, man git-remote), but still couldn't find the reason or the solution.

Local and remote branches are separate concepts. One big difference is remote branches will be automatically updated when you get updates from the remote repository, but local branches are only changed by you.

So if you have to remote branches origin/master and origin/something. If we automatically create the local branches 'master' and 'something' for you, just so you can see it in 'git branch', then at the next 'git fetch' (or 'git pull'), we're going to have a problem. The local branches will stay the same old values while origin/master and origin/something are kept uptodate. By the time you switch to and use branch 'something'. there may be a surprise for you.

Besides, tracking all remote branches only works well when you have one remote repository. Once you have another one, things get complicated

> Then I found https://stackoverflow.com/questions/10312521/how-to-fetch-all-git-branches which handles the subject...
> But still the most common solution there still looks like an ugly hack.
> Thus I suggest to improve the man-pages (unless done already)

Yeah I expected to see at least some definition of remote-tracking branches (vs local ones) but I didn't see one. Room for improvement.

-- 
Duy
Previous: Ulrich WindlNext: Philip Oakley
Message 2 of 13 in “Missing branches after clone”
  1. Ulrich WindlMay 14, 2019
  2. Duy NguyenMay 14, 2019
  3. Philip OakleyMay 14, 2019
  4. Duy NguyenMay 14, 2019
  5. Philip OakleyMay 14, 2019
  6. Duy NguyenMay 18, 2019
  7. Philip OakleyMay 19, 2019
  8. Antw: Re: Missing branches after cloneUlrich Windl, May 14, 2019
  9. Philip OakleyMay 15, 2019
  10. Ulrich WindlMay 15, 2019
  11. Philip OakleyMay 15, 2019
  12. Junio C HamanoMay 15, 2019
  13. Philip OakleyMay 15, 2019

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.