Master is 1 ahead of origin/master

This question already has an answer here:

  • Move the most recent commit(s) to a new branch with Git 9 answers

  • If you started out as below:

    O - O - 0 - C
               __ *master*
            |
       origin/master
    

    You need to branch

    git branch <branchname>
    
    O - O - 0 - C
               __ *master*, branchname
            |
       origin/master
    

    Now reset the master to origin/master

    git reset --hard origin/master
    
    O - O - 0 - C
               __ branchname
            |
       origin/master, *master*
    

    If you would like be on the new branch

    git checkout branchname
    
    O - O - 0 - C
               __ *branchname*
            |
       origin/master, master
    
    链接地址: http://www.djcxy.com/p/4292.html

    上一篇: 从之前的提交和拆分提交历史记录分支

    下一篇: 主人在起源/主人之前是1