Shravan Kumar Kasagoni

Skip Navigation
Update the local list of remote branches in the git repository

Update the local list of remote branches in the git repository

 /  3 responses

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.

Write a response

Your email address will not be published. Required fields are marked *

All code will be displayed literally.

Discussion