您可以通过编程的方式仅编辑最后一次提交的消息:
git commit --amend -m 'xxxxxxx'
或者交互式地随机提交:
git rebase -i HEAD~n
# Vim opens up, select the commit you want to modify, and change the word "pick" for "edit"
git commit --amend -m "Changing an old commit message!"
git rebase --continue
我该如何进行合并?我想以程序方式修改消息,但不仅限于最后一个提交,而是要修改到之前的某个提交。
我想要修改的提交已经被推送到 Git 服务器上,但不必考虑其他人重新同步 Git 项目的问题。
rebase -i
对你不起作用? - pishpishgit rebase -i
命令有一个 "reword" 选项。如果你只想修改一个提交记录的提交信息,那么使用此选项即可。 - Schwern