Skip to main content
  1. Learn
  2. Software Development
  3. Guides
  4. Git tutorial
  5. 如何使用 Git
  6. 如何在 Git 中管理历史记录
  7. 组合提交
GuidesSoftware DevelopmentBacklog

Project and code management together.




Current history

我们将把“append description of the commit command”和“append description of the pull command”这两个提交组合成一个提交。

为此,我们将使用 git rebase -i 命令

$ git rebase -i HEAD~~

当您默认的文本编辑器打开时,您将处于 rebase-interactive 模式。它会显示从 HEADHEAD 的提交~~,如下所示:

pick 9a54fd4 append description of the commit command
  pick 0d4a808 append description of the pull command

  # Rebase 326fc9f..0d4a808 onto d286baa
  # 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 log message
  #  x, exec = run command (the rest of the line) using shell
  # If you remove a line here THAT COMMIT WILL BE LOST.
  # However, if you remove everything, the rebase will be aborted.




通过使用 git log 命令来检查历史日志,验证结果。

Organize commit

Subscribe to our newsletter

Learn with Nulab to bring your best ideas to life