git rebase的问题-i头~2

git rebase的问题-i头~2,git,gitlab,Git,Gitlab,这是我的git日志: $ git log --oneline 0729a5e (HEAD -> feature/fork_deploy_function) merge with gitlab 0a6421d implement aws kubernetes deploy phase1 bde4da0 (origin/feature/fork_deploy_function) partially implement kubenetes deployment bde4da0是gitlab中最

这是我的git日志:

$ git log --oneline
0729a5e (HEAD -> feature/fork_deploy_function) merge with gitlab
0a6421d implement aws kubernetes deploy phase1
bde4da0 (origin/feature/fork_deploy_function) partially implement kubenetes deployment
bde4da0
是gitlab中最新的一个,我进行了一次本地提交
0a6421d
,以及一次拉合并分支提交
0729a5e
。现在,在我将本地提交推送到gitlab之前,我想通过使用
git rebase-I HEAD~2
将最后两次提交
0729a5e
0a6421d
压缩为一次提交,当我运行它时,我会在编辑器中得到提交
bde4da0
0a6421d
,而不是
0729a5e
0a6421d
。见下文:

pick 0a6421d implement aws kubernetes deploy phase1
pick bde4da0 partially implement kubenetes deployment

这是怎么发生的?在这种情况下,我如何才能挤压前两次提交?谢谢

我不知道为什么,但这不应该失败:

git checkout 0729a5e
git reset --soft bde4da0
# all changes introduced by the last two revisions will be in index, ready to be committed
git commit -m "squash"
# if you like the result
git branch -f feature/fork_deploy_function

您说过
0729a5e
是一个合并(“以及一个拉合并分支提交…”)。重基通常会放弃合并。使用
git log--graph
(也可以使用
--oneline
)或其他图形查看工具,在重定基址之前可视化图形。像这样的线性显示不会有多大帮助。