Wondercease

浙ICP备2022017321号

Git 修改已提交 commit 的信息

修改最后一次提交 commit 的信息

# 修改最近提交的 commit 信息

$ git commit –amend –message=”” –author=“”

# 仅修改 message 信息

$ git commit –amend –message=””

# 仅修改 author 信息

$ git commit –amend –author=””

修改历史提交 commit 的信息

git rebase -i 列出 commit 列表

找到需要修改的 commit 记录,把pick修改为edit或e,:wq保存退出

修改 commit 的具体信息git commit –amend,保存并继续下一条git rebase –continue,直到全部完成

补充

$ git rebase -i <commit id>

# 最近 3 条

$ git rebase -i HEAD~3

发表评论

您的电子邮箱地址不会被公开。