Below command shows, all the git branches (local, remote) in the local git repository.
git branch -a
The remote branches list the local git repository won’t be updated automatically even someone removes the remote branch on the server.
We can use the below command to update the local list of remote git branches.
git remote update origin --prune
Instead of the above command, we can use the flag --prune
with git fetch
or git pull
to update the local list of remote git branches every time.
git fetch --prune
git pull --prune
We can set to update the local list of remote git branches automatically every time we run git pull
or git fetch
using below command.
git config remote.origin.prune true
For the above command to work, we must be using git version 1.8.5 or above.
3 Comments
Ricky
Nicely explained all the options for refreshing the remote branches. Very helpful. Thanks!
Reza
very neat and helpful… thanks!
Aum
This is what i was looking for..Thanks