更新时间:2023-09-20 14:03:58
警告:以下git命令将重写feature
分支的历史记录. git rebase
和git reset
是危险的,因为它会对使用feature
分支的其他任何人造成严重破坏.
Warning: The following git commands will rewrite the history of the feature
branch. git rebase
and git reset
are dangerous because it can wreak havoc for anyone else who is using the feature
branch.
首先在与feature
相同的提交中创建分支other_feature
.
First create the branch other_feature
at the same commit as feature
.
git checkout -b other_feature feature
将前两次提交重新设置为master
.
Rebase the previous two commits onto master
.
git rebase --onto master HEAD~2
结帐feature
.
git checkout feature
将feature
重置为所需的提交.
git reset --hard HEAD~2