git 分支管理 推送本地分支到远程分支 git 分支管理 推送本地分支到远程分支等

git 分支管理 推送本地分支到远程分支等

<div class="article-info-box">
    <div class="article-bar-top d-flex">
                                            <span class="time">2015年08月03日 12:23:50</span>
        <div class="float-right">
            <span class="read-count">阅读数:55223</span>
                                        </div>
    </div>
</div>
<article>
    <div id="article_content" class="article_content clearfix csdn-tracking-statistics" data-pid="blog" data-mod="popu_307" data-dsm="post">
                <link rel="stylesheet" href="https://csdnimg.cn/release/phoenix/template/css/htmledit_views-0a60691e80.css">
        <div class="htmledit_views">

1、创建本地分支 local_branch

     git branch local_branch


2、创建本地分支local_branch 并切换到local_branch分支

   git checkout -b local_branch


3、切换到分支local_branch

    git checkout local_branch


4、推送本地分支local_branch到远程分支 remote_branch并建立关联关系

      a.远程已有remote_branch分支并且已经关联本地分支local_branch且本地已经切换到local_branch

          git push

     b.远程已有remote_branch分支但未关联本地分支local_branch且本地已经切换到local_branch

         git push -u origin/remote_branch

     c.远程没有有remote_branch分支并,本地已经切换到local_branch

        git push origin local_branch:remote_branch

5、删除本地分支local_branch

      git branch -d local_branch

6、删除远程分支remote_branch

     git push origin  :remote_branch

     git branch -m | -M oldbranch newbranch 重命名分支,如果newbranch名字分支已经存在,则需要使用-M强制重命名,否则,使用-m进行重命名。

   git branch -d | -D branchname 删除branchname分支

   git branch -d -r branchname 删除远程branchname分支


7、查看本地分支

      git branch


8、查看远程和本地分支

      git branch -a


      

   

        </div>
            </div>
        </article>

    <div class="article-bar-bottom">
                            <div class="tags-box">
        <span class="label">个人分类:</span>
                    <a class="tag-link" href="https://blog.csdn.net/hijiankang/article/category/5704191" target="_blank">git                        </a>
    </div>
                </div>

<!-- !empty($pre_next_article[0]) -->
    </div>

猜你喜欢

转载自blog.csdn.net/FLE123/article/details/80629576
今日推荐