これは動作するはずです:?。
1. git rebase -i HEAD~2
2. in your editor, select the following:
edit 9b86592 commit 2
pick f3907cb commit 3
3. at this point roll back the changes you made in fileB, for example with
`git checkout <version_you_want>` or by manually editing the file
4. make the changes in fileC you want to be part of commit 2
5. `git add fileB fileC`
6. `git commit --amend`
7. `git rebase --continue`
gitがしようとすると競合が発生した場合、マージ問題を解決する必要があるかもしれませんapply commit 3.それらを解決したら、git rebase --continue
を再度実行してください。
# checkout incorrect commit
git checkout <sha1_of_commit2>
# revert the changes to fileB by checking out the parent version
git checkout HEAD^ -- fileB
# make an amended commit
git commit --amend
# go back to master
git checkout master
# transplant the changes since the bad commit onto the amended commit
git rebase --onto [email protected]{1} <sha1_of_commit2>
'rebase -i'は簡単です、IMO。 – u0b34a0f6ae
@ kaizer.se:他の重要なステップに加えて、 'rebase -i'コマンドと対話型のリベースコミットリストを編集する必要があるので、説明するのに時間がかかります。 「手動で」行う方法を記述することは簡単です。 'rebase -i'を示唆する答えの多くは、レシピよりも多くのステップを含んでいるか、またはより複雑なステップや明示的に記述されていないより暗黙のステップです。 –