<分区>
我在 Git commit 方面遇到了一个小问题。所以我正在做一些项目并使用 Git。我做了一个 Git commit 并且我不小心写了一个错误的 commit message。所以我的问题是:
Is there anyway I can change the commit message in Git?
注意:我试过这样做:
git commit -a --amend -m "New Commit Message"
但它不起作用。为什么?
谢谢。
<分区>
我在 Git commit 方面遇到了一个小问题。所以我正在做一些项目并使用 Git。我做了一个 Git commit 并且我不小心写了一个错误的 commit message。所以我的问题是:
Is there anyway I can change the commit message in Git?
注意:我试过这样做:
git commit -a --amend -m "New Commit Message"
但它不起作用。为什么?
谢谢。
最佳答案
丢失第一个 -a
您没有添加任何文件,您只是更改 HEAD 提交:
git commit --amend -m"New Commit Message"
关于git - 更改 Git 中错误的提交信息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18208825/