git move locally committed changes to the new branch and push
I am on master
. When I do git status I am told
$ git status
# On branch master
# Your branch is ahead of 'origin/master' by 13 commits.
# (use "git push" to publish your local commits)
#
nothing to commit, working directory clean
So all 13 only exist on my local machine. The problem is that these 13 commits are now supposed to go on a new branch that I should create and push onto the server. I have tried looking at rebase but I am told
$ git rebase origina/master
fatal: Needed a single revision
invalid upstream origina/master
How would I go about pushing these changes into a new branch without messing up the master?
Just to clarify. This is not a duplicate of
moving committed (but not pushed) changes to a new branch this one simply does not work for me no matter what I do.
or
Git: Howto move changes since last commit to a new branch again is of no help.
Just do git checkout -b yourbranch
and push that.
Then reset master to origin/master.
Order:
git checkout -b mybranch
git push
git checkout master
git reset --hard origin/master
链接地址: http://www.djcxy.com/p/4304.html
上一篇: Git:将提交从主控移动到另一个分支
下一篇: git将本地提交的更改移动到新分支并推送