git command line to synchronize remote deleted branches

        People often use git branch –a to view all branches, including local and remote. But after a long time, you will find that some branches have been deleted long ago in the remote, but you can still see these deleted branches locally. The following describes how to synchronously delete branches that have been deleted remotely but not locally.

1. Use git branch -a to view local branches and all remote branches

 In fact, the red part above has been deleted remotely, but the local branch still exists.

2. View local branches and tracking

git remote show origin

 It shows that the branch at the red box no longer exists in the remote warehouse [deleted], and it can be used according to the prompt.

 git remote prune  to delete these branches synchronously.

3. Run the command to delete synchronously

git remote prune origin

 You can see that the branch in the red box is deleted, that is, the branch deleted by the remote branch has been deleted synchronously locally.

In addition, pull the content of all remote branches: git pulls the content of all remote branches_Riding the Wind and Waves kk's blog-CSDN blog There are too many remote project branches, and the local use of git branch only displays the master. Using git branch can only see the pulled master branch. Use git branch -a to view all. 3. At this time, use git branch locally to view all remote branches. https://blog.csdn.net/qq_40963664/article/details/127835856?csdn_share_tail=%7B%22type%22%3A%22blog%22%2C%22rType%22%3A%22article%22%2C%22rId%22 %3A%22127835856%22%2C%22source%22%3A%22qq_40963664%22%7D

Guess you like

Origin blog.csdn.net/qq_40963664/article/details/127835512