Git 使用 rebase 重新排序提交不起作用?
Git using rebase to reorder commits not working?
我正在尝试重新排序我的最后两次提交。
我有这样的订单
449b581 latest commit
8aa0c5a commit prior to latest commit
我开始使用命令进行变基
git rebase -i HEAD~2
这让我进入 VIM 编辑器,文本为
pick 8aa0c5a commit prior to latest commit
pick 449b581 latest commit
# Rebase a716b77..449b581 onto a716b77
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
切换后提交到
pick 449b581 latest commit
pick 8aa0c5a commit prior to latest commit
并退出 VIM 我得到
$ git rebase -i HEAD~2
Successfully rebased and updated refs/heads/master.
但我的日志还是一样。怎么会?在看到第一次没有按预期进行后,我尝试了不同顺序的选择命令。 ;)
没有错误,没有合并挂起或类似的东西。在重新排序提交之前,我不得不存储一些文件。它影响了 rebase 吗?
顺便说一句,我只想将我的最后一次提交推送到远程存储库,但我不希望之前的提交也在那里。我是否在正确的轨道上,或者我可以在不重新排序提交的情况下实现这一目标?
退出前是否保存文件vim?您可能只是简单地退出而没有保存,因此更改会丢失并且提交顺序会相同。因此 rebase 后没有变化。
我正在尝试重新排序我的最后两次提交。
我有这样的订单
449b581 latest commit
8aa0c5a commit prior to latest commit
我开始使用命令进行变基
git rebase -i HEAD~2
这让我进入 VIM 编辑器,文本为
pick 8aa0c5a commit prior to latest commit
pick 449b581 latest commit
# Rebase a716b77..449b581 onto a716b77
#
# Commands:
# p, pick = use commit
# r, reword = use commit, but edit the commit message
# e, edit = use commit, but stop for amending
# s, squash = use commit, but meld into previous commit
# f, fixup = like "squash", but discard this commit's log message
# x, exec = run command (the rest of the line) using shell
#
# These lines can be re-ordered; they are executed from top to bottom.
#
# If you remove a line here THAT COMMIT WILL BE LOST.
#
# However, if you remove everything, the rebase will be aborted.
#
# Note that empty commits are commented out
切换后提交到
pick 449b581 latest commit
pick 8aa0c5a commit prior to latest commit
并退出 VIM 我得到
$ git rebase -i HEAD~2
Successfully rebased and updated refs/heads/master.
但我的日志还是一样。怎么会?在看到第一次没有按预期进行后,我尝试了不同顺序的选择命令。 ;) 没有错误,没有合并挂起或类似的东西。在重新排序提交之前,我不得不存储一些文件。它影响了 rebase 吗?
顺便说一句,我只想将我的最后一次提交推送到远程存储库,但我不希望之前的提交也在那里。我是否在正确的轨道上,或者我可以在不重新排序提交的情况下实现这一目标?
退出前是否保存文件vim?您可能只是简单地退出而没有保存,因此更改会丢失并且提交顺序会相同。因此 rebase 后没有变化。