1. 更新本地分支存量表
删除远端不再存在的任何远程跟踪references,这之后再执行git branch -a,远端分支被删除的,就不会在git branch -a中展示。
$ git fetch -p origin
info: detecting host provider for 'http://git.xxx.net/'...
info: detecting host provider for 'http://git.xxx.net/'...
From http://git.xxx.net/yyy/aip
- [deleted] (none) -> origin/algo_test
- [deleted] (none) -> origin/alive
2. 删除远程分支
git push origin –delete origin/target_branch
3. 删除本地分支
删除本地分支
git branch -d target_branch
如果有没有merge到主分支的提交,会被提示无法删除,强制删除用-D
git branch -D target_branch