推空提交到远程 [英] Pushing empty commits to remote

查看:89
本文介绍了推空提交到远程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将一个提交推送到远程,但现在我意识到提交消息是不正确的。我想改变提交信息,但AFAIK是不可能的。所以我决定用正确的消息创建空的提交:

I have pushed one commit to remote but now I realized that the commit message is not correct. I would like to change the commit message but AFAIK it is not possible. So i decided to create empty commit with correct message:

git commit --allow-empty

推送空提交是否存在任何缺点/后果?是否有任何问题我将来可能会面临因为这个空的提交?

Are there any disadvantages/consequences of pushing empty commits? Is there any problem I might face in future because of this empty commit??

推荐答案

您不会面临任何可怕的后果,

You won't face any terrible consequence, just the history will look kind of confusing.

可以 通过更改提交消息

You could change the commit message by doing

git commit --amend
git push -f

这会覆盖您的远程历史记录,这意味着如果有人在此期间拉回该回购,此人会对您感到生气...

BUT this will override the remote history with yours, meaning that if anybody pulled that repo in the meanwhile, this person is going to be very mad at you...

如果您是唯一访问回购站的人,请执行此操作。

Just do it if you are the only person accessing the repo.

这篇关于推空提交到远程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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