Re: Missing branches after clone
- Date: Tue, 14 May 2019 17:12:03 +0700
- From: Duy Nguyen <pclouds@xxxxxxxxx>
- Subject: Re: Missing branches after clone
On Tue, May 14, 2019 at 4:42 PM Ulrich Windl
> 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
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
> 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.