If so, what is the command for that?
如果是这样,那命令是什么?
Thanks so much SO community!
非常感谢SO社区!
3 个解决方案
#1
5
If you have not committed:
如果你还没有承诺:
git checkout -b newbranch; git commit
If you have committed:
如果你已经承诺:
git checkout -b newbranch
If you have committed and not pushed and want to remove them from the old branch:
如果您已提交但未推送并希望将其从旧分支中删除:
git checkout -b newbranch; git checkout oldbranch; git reset --hard HEAD^
If you have committed and pushed and want to remove them from the old branch:
如果您已提交并推送并希望将其从旧分支中删除:
git checkout -b newbranch; git checkout oldbranch; git revert HEAD
I strongly recommend reading the Pro Git book. http://progit.org
我强烈建议你阅读Pro Git书。 http://progit.org
#3
0
It seems you already have commited changes that you want to commit again, but on another branch. Then you are looking for git cherry-pick
您似乎已经提交了要再次提交的更改,但在另一个分支上。然后你正在寻找git cherry-pick
#1
5
If you have not committed:
如果你还没有承诺:
git checkout -b newbranch; git commit
If you have committed:
如果你已经承诺:
git checkout -b newbranch
If you have committed and not pushed and want to remove them from the old branch:
如果您已提交但未推送并希望将其从旧分支中删除:
git checkout -b newbranch; git checkout oldbranch; git reset --hard HEAD^
If you have committed and pushed and want to remove them from the old branch:
如果您已提交并推送并希望将其从旧分支中删除:
git checkout -b newbranch; git checkout oldbranch; git revert HEAD
I strongly recommend reading the Pro Git book. http://progit.org
我强烈建议你阅读Pro Git书。 http://progit.org
#2
#3
0
It seems you already have commited changes that you want to commit again, but on another branch. Then you are looking for git cherry-pick
您似乎已经提交了要再次提交的更改,但在另一个分支上。然后你正在寻找git cherry-pick