I have looked through other questions on similar question.
But they seem to say the answer is git fetch --all
.
But in my case, it doesn't work.
This is what I have done for it.
> git branch
* master
> git branch -r
origin/master
origin/A
> git fetch --all
> git branch
* master #still not updated
> git fetch origin/A
fatal: 'origin/A' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
> git fetch remotes/origin/A
fatal: 'origin/A' does not appear to be a git repository
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
And I also tried git pull --all
also but the result is the same.
-------------------Edit-------------------
> git pull --all
Already up-to-date.
> git branch
* master # I think it should show branch A also
> git remote show origin
HEAD branch: master
Remote branches:
A tracked
master tracked
-------------------Edit-------------------
> git pull origin A
* branch A -> FETCH_HEAD
Already up-to-date.
> git branch
* master # I think it should show barnch A also
git branch
only displays local branches.
git branch -r
will display remote branches, as you've seen for yourself.
git branch
*master
git branch -r
origin/master
origin/A
git fetch --all
will update the list you see when you type git branch -r
but it will not create the corresponding local branches.
What you want to do is checkout the branches. This will make a local copy of the remote branch and set the upstream to the remote.
git checkout -b mylocal origin/A
git branch
master
*mylocal
git branch -r
origin/master
origin/A
mylocal
in this case is origin/A
. The -b
parameter will create the branch if it doesn't exist. You could also just type: git checkout A
will will auto-name the new branch.