【Git】使用 git rebase 整理提交歷史

【Git】使用 git rebase 整理提交歷史

本篇重點

  • 如果有尚未提交的變更,無法使用 git rebase
  • git rebase 合併不會產生額外的合併提交,但是會變更原本的提交 ID
  • git rebase -i(互動式 rebase)編輯功能
  • 使用 git rebase -i 調整提交順序、修改提交訊息、修改提交內容、合併提交、刪除提交
  • git rebase 的注意事項

【Git】使用 git commit 修改提交(commit)的資訊或是內容

【Git】使用 git commit 修改提交(commit)的資訊或是內容

本篇重點

  • git commit --amend 修改最新一次提交的資訊或是內容
  • git commit --amend --author 修改提交的作者和信箱
  • git commit --amend --reset-author 重置提交的作者和信箱
  • git commit --amend -m 修改提交訊息
  • git commit --amend --no-editor 提交修改但不修改提交訊息
  • 每次修改提交 git commit --amend 都會變更提交 ID

複製完成