[英]Rebase two commits from master in a new feature-branch
I accidentally made two commits on my master branch and now I want to rebase them both onto a new branch.我不小心在我的主分支上做了两次提交,现在我想将它们都重新定位到一个新的分支上。
Here you can see the initial situation...在这里你可以看到最初的情况......
-- -- -- C1 C2 (master)
\
(new-feature-branch)
...and how it should look in the end: ...以及它最终的外观:
-- -- -- (master)
\
C1 C2 (new-feature-branch)
Thanks for youre help谢谢你的帮助
Just move the pointers around只需移动指针
git branch temp new-feature-branch # create a temp pointer where master is
git checkout new-feature-branch
git reset --hard master # set feature where master is
git branch -f master temp # set master where new-feature-branch was
git branch -D temp
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.