When does Git refresh the list of remote branches?

后端 未结 5 585
清歌不尽
清歌不尽 2021-01-29 17:04

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 G

5条回答
  •  闹比i
    闹比i (楼主)
    2021-01-29 17:34

    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.

提交回复
热议问题