Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When does Git refresh the list of remote branches?

Using git branch --all shows all remote and local branches. When does Git refresh this list?

On pull/push? And how do I refresh it using Git Bash?

like image 432
BendEg Avatar asked Apr 01 '16 13:04

BendEg


People also ask

Does git pull update remote branch?

git pull updates your current local working branch, and all of the remote tracking branches.

What is the date command to view all the remote branches?

The git branch -r command is sufficient if you want a brief overview of all the branches stored on a remote. If you want more detailed information, the git remote show command may be more useful. This command returns: All remote branches.

Does git reset apply to all branches?

The "git branch -D" command will fail for current branch, but every other branch will get wiped.


2 Answers

To update the local list of remote branches:

git remote update origin --prune 

To show all local and remote branches that (local) Git knows about

git branch -a 
like image 120
centralcmd Avatar answered Oct 16 '22 16:10

centralcmd


The OP did not ask for cleanup for all remotes, rather for all branches of default remote.

So git fetch --prune is what should be used.

Setting git config remote.origin.prune true makes --prune automatic. In that case just git fetch will also prune stale remote branches from the local copy. See also Automatic prune with Git fetch or pull.

Note that this does not clean local branches that are no longer tracking a remote branch. See How to prune local tracking branches that do not exist on remote anymore for that.

like image 29
Oliver Avatar answered Oct 16 '22 15:10

Oliver