本文介绍了如何在git中编辑不正确的提交消息(我已推送)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在历史中更深入地修改提交消息,并推出了许多新的提交。



如何更改提交消息?是否有可能?

解决方案

来自Linus Torvalds的消息可能会回答您的问题:



简短回答:您不能(如果推送)。




提取(Linus引用BitKeeper为BK):


I want to modify a commit message deeper in history and I've pushed many new commits.

How do I change the commit message? Is it possible?

解决方案

The message from Linus Torvalds may answer your question:

Modify/edit old commit messages

Short answer: you can not (if pushed).


extract (Linus refers to BitKeeper as BK):


To be complete, you could rewrite your local commit history in order to reflect what you want, as suggested by sykora (with some rebase and reset --hard, gasp!)

However, once you publish your revised history again (with a git push origin +master:master, the + sign forcing the push to occur, even if it doesn't result in a "fast-forward" commit)... you might get into some trouble.

Extract from this other SO question:

这篇关于如何在git中编辑不正确的提交消息(我已推送)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-03 20:00