git删除本地分支、删除远程分支 复制分支
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
?
?
總結
以上是生活随笔為你收集整理的git删除本地分支、删除远程分支 复制分支的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 你的电脑还在乱弹广告你的电脑还在乱弹广告
- 下一篇: 电脑Windows磁盘修复工具如何使用电