赞
踩
git branch -d develop
$ git branch -d develop error: Cannot delete branch 'develop' checked out at '/Users/xxx/work/git/xxx-server' $ git checkout feature/gantt20180830 Switched to branch 'feature/gantt20180830' Your branch is up to date with 'origin/feature/gantt20180830'. $ git branch -a develop feature/20180620issuearchive * feature/gantt20180830 feature/refactor_finish master testing remotes/origin/HEAD -> origin/master remotes/origin/customer_field_cache remotes/origin/develop remotes/origin/es_search $ git branch -d develop warning: deleting branch 'develop' that has been merged to 'refs/remotes/origin/develop', but not yet merged to HEAD. Deleted branch develop (was 4a47bd100). $ git branch -a feature/20180620issuearchive * feature/gantt20180830 feature/refactor_finish master testing remotes/origin/HEAD -> origin/master remotes/origin/customer_field_cache remotes/origin/develop remotes/origin/es_search
可以看到已经删除掉本地分支develop了,总结一下就是删除前本地分支不能是即将要删除的分支
git push origin :hotfix/movebug20180629
20240117更新:推荐使用新的命令格式
git push origin --delete master_bak
$ git branch -a * develop feature/20180620issuearchive feature/gantt20180830 feature/refactor_finish master remotes/origin/hotfix/listMove remotes/origin/hotfix/listcopy20180115 remotes/origin/hotfix/movebug20180629 remotes/origin/hotfix/newFunction-20180130 remotes/origin/hotfix/relation_search $ git push origin :hotfix/movebug20180629 remote: delete branch, skip check... remote: run code_review post hook success To http://git.xiaojukeji.com/lean/lean-server.git - [deleted] hotfix/movebug20180629 $ git branch -a * develop feature/20180620issuearchive feature/gantt20180830 feature/refactor_finish master testing remotes/origin/hotfix/listMove remotes/origin/hotfix/listcopy20180115 remotes/origin/hotfix/newFunction-20180130 remotes/origin/hotfix/relation_search
在这个命令git push origin :hotfix/movebug20180629
当中,你需要注意的是 (注意origin后面有一个空格)
git checkout -b develop
$ git branch -a feature/20180620issuearchive * feature/gantt20180830 feature/refactor_finish master testing remotes/origin/HEAD -> origin/master remotes/origin/customer_field_cache remotes/origin/develop remotes/origin/es_search $ git checkout -b develop Switched to a new branch 'develop' $ git branch -a * develop feature/20180620issuearchive feature/gantt20180830 feature/refactor_finish master testing remotes/origin/HEAD -> origin/master remotes/origin/customer_field_cache remotes/origin/develop remotes/origin/es_search
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。