How to?

修改历史上的 commit message

Jun 1, 2025
softwares-and-toolsgitcommit
1 Minutes
56 Words
This article was last updated on May 27, 2026 and some of the information may no longer be applicable due to the passage of time.

修改历史上的 commit message

  • 要修改的 commit hash code 假设为 A
  • git rebase -i A~1
  • 会出现一个编辑界面,在需要修改的 commit 的 hash 前面把 pick 改为 edit
  • git commit --amend 修改 message
  • git rebase --continue
  • git push -f
Article title:修改历史上的 commit message
Article author:Julyfun
Release time:Jun 1, 2025
Copyright 2026
Sitemap