Git 删除/删除交互重基中的当前提交

Git 删除/删除交互重基中的当前提交,git,git-rebase,git-interactive-rebase,Git,Git Rebase,Git Interactive Rebase,我在一个交互式的重基中,已经标记了我需要用编辑(e)仔细查看的提交。现在在查看提交时,我意识到需要删除/删除一些提交。在交互模式中,哪种提交方式正确 目前,我执行以下命令: $ git reset HEAD^ $ git checkout -- <File> # <- here I list all of the files that need to be reset $ git rebase --continue # this complains that I have to

我在一个交互式的重基中,已经标记了我需要用
编辑
e
)仔细查看的提交。现在在查看提交时,我意识到需要删除/删除一些提交。在交互模式中,哪种提交方式正确

目前,我执行以下命令:

$ git reset HEAD^
$ git checkout -- <File> # <- here I list all of the files that need to be reset
$ git rebase --continue # this complains that I have to perform git commit --allow-empty or git reset
# since I don't want the empty commit I do …
$ git reset
$ git rebase --continue
但这会产生合并冲突

那么,在交互式重新基址的编辑模式下,删除当前提交的最简单方法是什么呢?

如果您
git reset--hard
您也会丢失当前提交的更改,因此我认为会发生冲突。相反,您可以使用

git reset HEAD^
并使用当前提交中的更改修改上次提交:

git add your_changes
git commit --amend -m "new commit message"
那么,在交互式重基的编辑模式下,删除当前提交的最简单方法是什么

对我来说,到目前为止,最简单的方法是记下我要删除的提交(主题行和任何其他识别标记),完成交互式基础,然后启动一个新的交互式基础,并将提交标记为“删除”。没有必要一次做完所有的事情

git add your_changes
git commit --amend -m "new commit message"