Skip to content Skip to footer

Update the local list of remote branches in the git repository

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
    Posted Sep 22, 2020 at 8:36 pm

    Nicely explained all the options for refreshing the remote branches. Very helpful. Thanks!

  • Reza
    Posted Feb 18, 2021 at 11:25 pm

    very neat and helpful… thanks!

  • Aum
    Posted Jan 12, 2022 at 12:48 am

    This is what i was looking for..Thanks

Leave a comment

0/100