在Git中编辑一个不正确的提交消息,它已经被推送 [英] Edit an incorrect commit message in Git that has already been pushed

查看:92
本文介绍了在Git中编辑一个不正确的提交消息,它已经被推送的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一次Git commit和push,但在评论中写了完全错误的东西。

如何更改评论?我已经将提交推送到远程。

解决方案

git commit --amend

如果你已经推送了这个提交,你需要运行 git push --force 只有在您确定没有人将其取消时才会这样做 如果用户从您的存储库中提取了提交,只需保留该提示即可。


I did a Git commit and push, but wrote the totally wrong thing in the comment.

How do I change the comment? I have already pushed the commit to the remote.

解决方案

git commit --amend will allow you to edit the commit message.

If you already pushed that commit, you need to run git push --force. Only do that if you are sure nobody pulled it yet!

If people pulled the commit from your repo, simply leave the message as it is.

这篇关于在Git中编辑一个不正确的提交消息,它已经被推送的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆