如何在GitHub中更改提交历史记录?

问题描述

我已尝试以交互方式git rebase来压缩提交。我也曾在软模式下尝试过git reset,然后进行了一次提交。

似乎更改了我的git log。但是当我需要推送到GitHub时,它说不能推送,由于分支分支不同,我需要先拉。

拉动然后推动后,当我转到GitHub时,我发现提交次数仅增加了

如何更改GitHub存储库的提交页面上的历史记录?

解决方法

此时

它说不能推,由于分支不同,我需要先拉。

你应该做

git push -f 

这将为您提供所需的结果。希望其他贡献者,如果有的话,不管您从事什么工作,都不要介意提交历史记录是否已更改。

建议阅读:Git Push

,

最好使用git push --force-with-lease
git push --force-with-lease vs. --force

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...