跳转至

删除分支

git 删除分支

  • 在网站上查看分支
Bash
https://github.ibm.com/compiler/wyvern/issues/5859#issuecomment-18693834

https://github.ibm.com/compiler/llvm-project/branches/yours
https://github.ibm.com/compiler/scripts/branches/yours
https://github.ibm.com/compiler/test-suite/branches/yours

1. 删除本地分支

Bash
git branch -d Chapater8  // 如果主分支上对应的分支还在,则正确,否则会提示使用-D,安全删除 推荐
git branch -D Chapater8  // 小心使用,此时可能主分支已被删除,本地是唯一一份代码,强制删除
Bash
[shkzhang@recycler:~/llvm_project]$ git branch -d shkzhang_alias
error: The branch 'shkzhang_alias' is not fully merged.
If you are sure you want to delete it, run 'git branch -D shkzhang_alias'.

[shkzhang@recycler:~/llvm_project]$ git branch -D shkzhang_alias
Deleted branch shkzhang_alias (was 6f20505fcb9).

2. 删除远程分支

Bash
git push origin --delete shkzhang_isseue184   // 不需要加remotes/origin/shkzhang_issue184

错误

Bash
remote refs do not exist

https://blog.csdn.net/harryptter/article/details/58129187
解决的方法是 在git 命令行终端输入 git fetch -p origin