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

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

问题描述

提交后有没有办法在线编辑GitHub.com中的提交信息?

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

从命令行,可以做到

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

正如另一个问题.

尝试 git pull 然后 git push 成功(同时没有任何其他提交干扰).

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

但是可以通过 GitHub 网站完成吗?

But can it be done via the GitHub website?

推荐答案

不,这不是直接可能的.每个 Git 提交的哈希值也是根据提交消息计算的.当您更改提交消息时,您会更改提交哈希.如果你想推送那个提交,你必须强制推送(git push -f).但是,如果已经有人拉取了您的旧提交并根据该提交开始了一项工作,则他们将不得不将他们的工作重新建立在您的新提交上.

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, they would have to rebase their work onto your new commit.

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

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