moving committed (but not pushed) changes to a new branch after pull

后端 未结 10 1560
灰色年华
灰色年华 2020-12-22 15:51

I\'ve done a fair bit of work (\"Your branch is ahead of \'origin/master\' by 37 commits.\") which really should have gone into its own branch rather than into master<

10条回答
  •  忘掉有多难
    2020-12-22 16:21

    I stuck with the same issue. I have found easiest solution which I like to share.

    1) Create new branch with your changes.

    git checkout -b mybranch
    

    2) (Optional) Push new branch code on remote server.

    git push origin mybranch
    

    3) Checkout back to master branch.

    git checkout master
    

    4) Reset master branch code with remote server and remove local commit.

    git reset --hard origin/master
    

提交回复
热议问题