Git Commit to New Branch

This question already has an answer here:

  • Move existing, uncommitted work to a new branch in Git 4 answers

  • The same.

    You can do the checkout afterwards (as longs as it is a new branch).

    3) git checkout new_branch
    4) commit, and it automatically gets put in the new branch
    

    Note that you can also create and checkout in one command:

    git checkout -b new_branch
    

    Commit your changes to your current branch. Then create a new branch from your current branch.

    $ git checkout -b new_branch currentbranch
    

    Checkout back your currentbranch

    $ git checkout currentbranch
    

    Reset the currentbrach by 1 commit

    $ git reset HEAD~1
    
    链接地址: http://www.djcxy.com/p/23584.html

    上一篇: Git:从master上未分配/未提交的更改中创建一个分支

    下一篇: Git承诺新分支