我有一个旧的提交A
。当我提交A
时,我更改了2个文件:F1
和F2
。我想更改A,因此它仅修改文件F1
。我想分别提交F2
。我不要从我的git存储库中删除F1
。
我尝试通过
git rebase -i HEAD~3 // The exact number doesn't matter,I just change "pick" to "edit" next to A
git reset HEAD^ // unstage all changes
git add F1 // don't add F2,we want to commit it separately
git rebase --continue
但是,这给出了错误
F2: needs update
You must edit all merge conflicts and then
mark them as resolved using git add
我通过做git rebase --skip
但是,这会完全从git历史记录中删除提交A
。
我在做什么错了?
我查看了SO上的其他帖子,并尝试了解决方案,但是它们没有用。