【发布时间】:2023-03-12 17:51:02
【问题描述】:
在使用命令进行暂存、提交和推送后,我在这里要求Git command to commit all changes including files removed or created,我输入了错误的提交消息,然后将其推送到我的 Github 帐户。我是我的 repo 的唯一贡献者,因此无需担心 拉动 问题。
我已经遵循了Changing git commit message after push (given that no one pulled from remote) 和Edit an incorrect commit message in Git that has already been pushed 这里给出的建议,这基本上是要做的:
git commit --amend
这会打开我的文本编辑器 (Sublime),显示上次提交的消息。在那里我修改此消息,保存并关闭文件。之后我输入:
git push origin master --force
这似乎工作正常。但如果我现在做一个:
git log
我在上次提交中一直看到错误(即:旧)消息,我的 Github 帐户没有显示任何更改。我做错了什么?
【问题讨论】:
-
确定你在正确的分支上?
-
我只有一个分支:master 分支。
-
如果你这样做会怎样
git push origin HEAD:master --force