When you git fetch
sometimes you may not see all origin branches when you issue the command git branch -a
or git branch -r
.
This happens sometimes, if you change the remote repository with:
git remote set-url origin https://github.com/{owner}/{repository}
When this happens, exit .git/config
and look for a hard-coded branch name in the origin:
[remote "origin"]
url = https://github.com//{owner}/{repository}
fetch = +refs/heads/{branch_name}:refs/remotes/origin/{branch_name}
Change it to a wild card:
[remote "origin"]
url = https://github.com//{owner}/{repository}
fetch = +refs/heads/*:refs/remotes/origin/*
Now, git fetch
will properly grab references to the origin's branches.