-
Notifications
You must be signed in to change notification settings - Fork 2
Git操作 删除分支
bin4xin edited this page Apr 29, 2022
·
1 revision
- 先查看需要删除的分支
> git branch -a
* main
remotes/origin/HEAD -> origin/main
remotes/origin/about
remotes/origin/gh-pages
remotes/origin/main
remotes/origin/master
- 我们这里需要删除
master
与about
分支:
TIPS:
当然如果你还在一个这个分支上时,那么 Git 是不允许你删除这个分支的。所以,请记得退出分支:
git checkout main
> git push origin --delete about
To https://github.com/Bin4xin/bin4xin.github.io.git
- [deleted] about
> git push origin --delete master
···
- [deleted] master
- 查看效果:
> git branch -a
* main
remotes/origin/HEAD -> origin/main
remotes/origin/gh-pages
remotes/origin/main
- 用
git branch -d localBranchName
命令来删除本地的分支-
git branch -d about
&&git branch -d master
-
TIPS:
error: unable to push to unqualified destination: remoteBranchName The destination refspec neither matches an existing ref on the remote nor begins with refs/, and we are unable to guess a prefix based on the source ref. error: failed to push some refs to 'git@repository_name'
表示其他人已经删除了该分支,使用
git fetch -p
同步分支;
wiki 贡献者 Bin4xin • feifei1606 • codecat