You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Git交互式变基时,如何查看编辑/合并后的修改差异?

交互式变基中的状态疑问

我正尝试将feature分支变基到自开发开始后已更新的dev分支。以下是变基前的提交历史(省略部分内容):

$ git log --oneline
21c72f6 (HEAD -> feature, origin/feature) Mattermost loggin...
fade238 GUI message typ...
daaeb54  Message gramma...
bf09129 Error handling for...
94eb0de Notes in comment...
379a6c9 Cleanup
057a7d5 Update `check_fs...
edd44b4 Update `check_p...
5639c61 Update `sse_con...
0000000 <last_commit_before_my_feature_branch>

在9个提交中,3个为核心功能实现,其余6个是无关紧要的整理操作,我想将它们合并为一个“cleanup”提交,同时调整了部分提交顺序。我的git-rebase-todo文件内容如下:

pick 5639c61 Update `sse_con...
pick edd44b4 Update `check_p...
pick bf09129 Error handling for...
edit 379a6c9 Cleanup
fixup 057a7d5 Update `check_fs...
fixup 94eb0de Notes in comment...
fixup daaeb54 Message gramma...
fixup fade238 GUI message typ...
fixup 21c72f6 Mattermost loggin...

我使用VS Code的GitLens扩展执行git rebase -i dev启动交互式变基。

我希望在将编辑/合并后的修改作为新提交应用前查看这些变更。当进入标记为edit的提交379a6c9 Cleanup时,我期望看到“待提交的变更”列表,展示前一个提交bf09129 Error handling for...与即将生成的编辑/合并提交的差异(类似git cherry-pick --no-commit的效果),但除非遇到冲突,VS Code仅显示“Continue”选项,CLI状态如下:

$ git status
interactive rebase in progress; onto 1aeafea
Last commands done (4 commands done):
   pick bf09129 Error handling for...
   edit 379a6c9 Cleanup
  (see more in file .git/rebase-merge/done)
Next commands to do (5 remaining commands):
   fixup 057a7d5 Update `check_fs...
   fixup 94eb0de Notes in comment...
  (use "git rebase --edit-todo" to view and edit)
You are currently editing a commit while rebasing branch 'feature' on '1aeafea'.
  (use "git commit --amend" to amend the current commit)
  (use "git rebase --continue" once you are satisfied with your changes)

nothing to commit, working tree clean

我不确定这是VS Code/GitLens的特性还是操作失误,也不清楚当前Git状态:Git是否在后台执行了额外操作?后续提交的合并是否已完成?用Git术语该如何描述此状态?


内容的提问来源于stack exchange,提问作者Collin

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.19 23:45:13