git 分支合併 提交本地分支到遠端分支相關命令
阿新 • • 發佈:2019-01-05
-
建立分支
git branch localbranch
-
切換分支
git checkout localbranch
-
建立分支並切換到該分支,等效於上面兩個命令都執行
git checkout -b localbranch
-
在本地更改完分支的程式碼後,add並commit後,需要合併分支到主幹的話執行
git checkout master
git merge localbranch //合併分支到當前分支 -
無需合併至主幹,直接將本地分支提交到遠端倉庫的新分支的話執行
git push origin localbranch:remotebranch //將本地分支localbranch提交到遠端分支remotebranch,如果遠端沒有改分支則自動建立
-
檢視本地所有分支以及當前所在分支
git branch //當前分支前有 * 號
-
刪除本地分支
git branch -D localbranch
-
刪除遠端分支
git push origin :remotebranch //不加本地分支時進行提交即刪除遠端分支
<script> (function(){ function setArticleH(btnReadmore,posi){ var winH = $(window).height(); var articleBox = $("div.article_content"); var artH = articleBox.height(); if(artH > winH*posi){ articleBox.css({ 'height':winH*posi+'px', 'overflow':'hidden' }) btnReadmore.click(function(){ articleBox.removeAttr("style"); $(this).parent().remove(); }) }else{ btnReadmore.parent().remove(); } } var btnReadmore = $("#btn-readmore"); if(btnReadmore.length>0){ if(currentUserName){ setArticleH(btnReadmore,3); }else{ setArticleH(btnReadmore,1.2); } } })() </script> </article>