我的问题类似于git remove commit from a merge但我无法按照那里建议的说明进行操作,因为我的存储库的历史有点不同。
我正在 github 上开发一个开源存储库。几个月后,我想更新我的本地存储库,但我错误地做了一个无用的合并提交。历史如下所示:
* commit 3d542ddb64e6474a10dfface24defc69b713a295
| Author: TD
|
| fixed typo in dependency_injection/compilation chapter
|
* commit 34db3b8c08e5c5d3be4021076716ed90187fe5fb
|\ Merge: b8b73fb 7cc08f4
| | Author: TD
| |
| | Merge remote-tracking branch 'upstream/master'
| |
| * commit 7cc08f476b7ac5610b1eb5b5db5182d18e35a9e9
| | Author: RW
| |
| | [#1654] Tweaking comments
...
我的小改动应该只有一个提交,但有两个。我只想删除 34db3b8c0... 合并提交。我知道我应该尝试交互式 rebase,但我不知道如何设置它。当我尝试
git rebase -i HEAD~2
我得到了一个巨大的过去提交列表:
pick bbfbddb Add the new "strict_requirements"
pick 31bb8a9 [reference] Tweaking note about strict_requirements
pick fb4d621 [Cookbook][Extension] Fixed typo in functions name
pick d8d1d86 Fixing index typo
# lots and lots of commits in the history here
pick c734436 Fixed indentation.
pick ca8d884 Update cookbook/logging/channels_handlers.rst
pick 7cc08f4 [#1654] Tweaking comments in channel handlers doc to point to reference
pick 3d542dd fixed typo in dependency_injection/compilation chapter: should be contAiner instead of continer
# Rebase b8b73fb..3d542dd onto b8b73fb
#
# Commands:
...
但是当我尝试时:
git rebase -i HEAD~1
(想要一个更短的列表)我只得到一个提交:
pick 3d542dd fixed typo in dependency_injection/compilation chapter: should be contAiner instead of continer
据我了解,我应该使用交互式变基来压缩合并提交 34db3b8c08... ,对吗?
谢谢你的帮助。