删除远程分支的尝试失败 :
$ git branch -d remotes/origin/bugfix
error: branch 'remotes/origin/bugfix' not found.
$ git branch -d origin/bugfix
error: branch 'origin/bugfix' not found.
$ git branch -rd origin/bugfix
Deleted remote branch origin/bugfix (was 2a14ef7).
$ git push
Everything up-to-date
$ git pull
From github.com:gituser/gitproject
* [new branch] bugfix -> origin/bugfix
Already up-to-date.
我如何正确删除remotes/origin/bugfix
本地和远程分支?
提示:当您使用删除分支时
git branch -d <branchname> # Deletes local branch
或
git push origin :<branchname> # Deletes remote branch
仅删除引用。 即使该分支实际上在远程删除, 但它的引用仍然存在于您的团队成员所在的本地存储库中 。 这意味着对于其他团队成员来说, 被删除的分支在做一个git branch -a
.
为了解决这个问题,你的团队成员可以使用
git remote prune <repository>
这是典型的git remote prune origin
.
要删除本地本地- (正常)
git branch -d my_branch
如果分行进展迟缓,而且未适当完成,那表示你们是误入歧途的。Rebase/Merge in progress
,在这种情况下,你将无法删除你的分支。
所以要么你要么你需要解决 重新定位/合并的问题。 否则,你可以用武力删除删除通过使用,
git branch -D my_branch
删除偏远:
git push --delete origin my_branch
您可以使用 :
git push origin :my_branch # Easy to remember both will do the same.
图形代表:
