Skip to main content
  1. Learn center
  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 commandappend 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