美文网首页
Git命令 切换分支

Git命令 切换分支

作者: 狂奔的大蜗牛 | 来源:发表于2018-08-20 19:31 被阅读0次

    1、查看远程分支
    项目根目录下执行以下命令:

    xiaoqi:dev xq$ git branch -a
    * feature-hr
      remotes/origin/HEAD -> origin/master
      remotes/origin/feature-finance
      remotes/origin/feature-hr
      remotes/origin/master
    

    2、查看本地分支

    xiaoqi:dev xq$ git branch
    * feature-hr
    

    3、切换分支

    xiaoqi:dev xq$ git checkout -b feature-finance origin/feature-finance
    Branch feature-finance set up to track remote branch feature-finance from origin.
    Switched to a new branch 'feature-finance'
    xiaoqi:dev xq$
    

    切换后的本地分支

    xiaoqi:dev xq$ git branch
    * feature-finance
      feature-hr
    

    4、切回master分支

    xiaoqi:dev xq$ git checkout master
    Switched to branch 'master'
    Your branch is up-to-date with 'origin/master'.
    

    相关文章

      网友评论

          本文标题:Git命令 切换分支

          本文链接:https://www.haomeiwen.com/subject/retriftx.html