删除远程分支的尝试失败 :
$ 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
本地和远程分支?
最初的几种方法对我行不通。
假设你有以下分支和远程分支,
Local : Test_Branch
Remote: remotes/origin/feature/Test_FE
正确设置上方为您本地分支以跟踪您想要删除的远程分支 。
git branch --set-upstream-to=remotes/origin/feature/Test_FE Test_Branch
然后删除远程分支执行此任务
git push origin --delete Test_Branch
然后删除本地分支,按照命令执行
git branch -D Test_Branch
就是这样。
要删除本地本地- (正常)
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.
图形代表:
