Git Git 已被其他开发删除的远程分支,本地依旧显示,如何删除?

fence · February 27, 2015 · Last by a493071294 replied at September 23, 2019 · 29587 hits

hi all: 如何让已经失效的远程 branch-name 在执行 git branch -a 的时候不再展示?

有同事 push 了一个 git 分支,并且被我给 pull 到本地了

同事在自己机器上执行了 git branch -d branch-name git push origin :branch-name

我在自己机器执行 git branch -d branch-name //ok git push origin :branch-name //提示:

error: unable to delete 'branch-name': remote ref does not exist error: 无法推送一些引用到 'git@gitserver:phplib'

大家帮忙想想办法让已经失效的远程 branch-name 在执行 git branch -a 的时候不再展示吧?谢谢

试试

git fetch -p

#1 楼 @cod7ce cool!谢谢。

git remote prune origin 清理远程分支,把本地不存在的远程分支删除

Reply to verphen

正解!cool!

Reply to verphen

有效,非常感谢

You need to Sign in before reply, if you don't have an account, please Sign up first.