在GitHub中编辑git commit消息 [英] Editing the git commit message in GitHub

查看:144
本文介绍了在GitHub中编辑git commit消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何方法可以在提交后在 GitHub.com 中在线编辑提交消息?



从在命令行中,可以执行

  git commit --amend -m新提交消息

正如

尝试 git pull 另一个问题。 c>,然后 git push 已经工作(没有任何其他提交同时受到干扰)。可以通过 GitHub 网站完成吗?

解决方案

不,这个不是直接可能的。每个Git提交的哈希也基于提交消息进行计算。当您更改提交消息时,您将更改提交哈希。如果你想推送提交,你必须强制推送(git push -f)。但如果已经有人拉你的旧提交并开始基于该提交的工作,他将不得不将他的工作重新分配到新的提交中。


Is there any way of online editing the commit message in GitHub.com, after submission?

From the command line, one can do

git commit --amend -m "New commit message"

as correctly suggested in another question.

Trying git pull and then git push has worked (without any other commit having interfered in the mean time).

But can it be done via the GitHub website?

解决方案

No, this is not directly possible. The hash for every Git commit is also calculated based on the commit message. When you change the commit message, you change the commit hash. If you want to push that commit, you have to force that push (git push -f). But if already someone pulled your old commit and started a work based on that commit, he would have to rebase his work onto your new commit.

这篇关于在GitHub中编辑git commit消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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