Git 修改历史Commit注释

发布于 分类 WEB技术

git commit提交后,发觉有的commit注释并不清晰,需要修改。

步骤

# 要修改commit的前一次commit_id
git rebase -i {commit_id}

# 将要修改的某次commit行前的pick改为edit后,保存退出

# 修改commit
git commit -amend

# 保存退出后
git rebase --continue 

PS: 如果是针对上一次,不需要git rebase

提交远程仓库

git push 前需要 get pull 合并然后才能提交,否者会出现non-fast-forward 提示信息提示提交失败

-- The End --

本文标题: Git 修改历史Commit注释

本文地址: https://seonoco.com/blog/git-commit-amend

本页面显示内容已针对移动端进行优化,点击查看完整版本