git删除本地分支、删除远程分支
It_BeeCoder 2019-05-15 09:47:20 80268 收藏 15
展开
https://blog.csdn.net/lihua5419/article/details/81706905
-
1、查看所有分支
-
git branch -a
-
2、查看当前所在分支
-
git branch
-
3、删除本地的bug_xzx分支
-
git branch -d bug_xzx
-
4、删除远程的bug_xzx分支
-
git push origin --delete bug_xzx
推荐大家一个好用的git分支管理工具SourceTree,如下图所示可以直接从远程拉取分支到本地,并且可视化对分支进行操作
git —— 将当前分支复制到新建分支
一闪一闪亮晶晶,漫天都是小星星 2020-01-09 17:56:44 335 收藏
展开
eg:
当前分支:i-health 新分支:i-health-noTab
1. 当前分支:i-health
从当前分支copy开发分支
git checkout -b i-health-noTab
运行,此时当前分支变为 i-health-noTab
2. 把新建的分支push到远端
git push origin i-health-noTab
3。 将分支与远端关联
git branch --set-upstream-to=origin/i-health-noTab
4.拉取代码成功
git pull
————————————————
版权声明:本文为CSDN博主「一闪一闪亮晶晶,漫天都是小星星」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/assassin_0302/article/details/103913300
Administrator@PC-201908221240 MINGW64 /c/workspace/idea/unicom/saas/app_resource_newbranch/thrall-user ( feature/switch_db_app_res)
$ git branch
feature/switch_db
master
* feature/switch_db_app_res
Administrator@PC-201908221240 MINGW64 /c/workspace/idea/unicom/saas/app_resource_newbranch/thrall-user ( feature/switch_db_app_res)
$ git push origin feature/switch_db_app_res
error: src refspec feature/switch_db_app_res does not match any
error: failed to push some refs to 'http://git.dev.wochanye.com/gateway/thrall-user.git'
Administrator@PC-201908221240 MINGW64 /c/workspace/idea/unicom/saas/app_resource_newbranch/thrall-user ( feature/switch_db_app_res)
$ git push 上面的命令不行这个就好了 推的就是当前分支
fatal: The current branch feature/switch_db_app_res has no upstream branch.
To push the current branch and set the remote as upstream, use
git push --set-upstream origin feature/switch_db_app_res
Administrator@PC-201908221240 MINGW64 /c/workspace/idea/unicom/saas/app_resource_newbranch/thrall-user ( feature/switch_db_app_res)
$ git push --set-upstream origin feature/switch_db_app_res
Total 0 (delta 0), reused 0 (delta 0)
remote:
remote: To create a merge request for feature/switch_db_app_res, visit:
remote: http://git.dev.wochanye.com/gateway/thrall-user/-/merge_requests/new?merge_request%5Bsource_branch%5D=%C2%A0feature%2Fswitch_db_app_res
remote:
To http://git.dev.wochanye.com/gateway/thrall-user.git
* [new branch] feature/switch_db_app_res -> feature/switch_db_app_res
Branch ' feature/switch_db_app_res' set up to track remote branch ' feature/switch_db_app_res' from 'origin'.
Administrator@PC-201908221240 MINGW64 /c/workspace/idea/unicom/saas/app_resource_newbranch/thrall-user ( feature/switch_db_app_res)
$ git push origin feature/switch_db_app_res
error: src refspec feature/switch_db_app_res does not match any
error: failed to push some refs to 'http://git.dev.wochanye.com/gateway/thrall-user.git'
Administrator@PC-201908221240 MINGW64 /c/workspace/idea/unicom/saas/app_resource_newbranch/thrall-user ( feature/switch_db_app_res)
$ git push
Everything up-to-date
Administrator@PC-201908221240 MINGW64 /c/workspace/idea/unicom/saas/app_resource_newbranch/thrall-user ( feature/switch_db_app_res)
$ git push origin feature/switch_db_app_res
error: src refspec feature/switch_db_app_res does not match any
error: failed to push some refs to 'http://git.dev.wochanye.com/gateway/thrall-user.git'
Administrator@PC-201908221240 MINGW64 /c/workspace/idea/unicom/saas/app_resource_newbranch/thrall-user ( feature/switch_db_app_res)
$ git pull
Already up to date.
Administrator@PC-201908221240 MINGW64 /c/workspace/idea/unicom/saas/app_resource_newbranch/thrall-user ( feature/switch_db_app_res)
$ git status
On branch feature/switch_db_app_res
Your branch is up to date with 'origin/ feature/switch_db_app_res'.
nothing to commit, working tree clean
Administrator@PC-201908221240 MINGW64 /c/workspace/idea/unicom/saas/app_resource_newbranch/thrall-user ( feature/switch_db_app_res)
$ git pull
Already up to date.
Administrator@PC-201908221240 MINGW64 /c/workspace/idea/unicom/saas/app_resource_newbranch/thrall-user ( feature/switch_db_app_res)
$ git push
Everything up-to-date
Administrator@PC-201908221240 MINGW64 /c/workspace/idea/unicom/saas/app_resource_newbranch/thrall-user ( feature/switch_db_app_res)
$ git branch
feature/switch_db
master
* feature/switch_db_app_res
Administrator@PC-201908221240 MINGW64 /c/workspace/idea/unicom/saas/app_resource_newbranch/thrall-user ( feature/switch_db_app_res)
$ git branch -r
origin/HEAD -> origin/master
origin/feature/switch_db
origin/feature/upgrade_ci
origin/hotfix/auth_call_http
origin/master
origin/multi_data_source
origin/ feature/switch_db_app_res