且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何删除错误的合并提交?

更新时间:2023-12-03 13:03:22

Have you looked at the reflog? It keeps track of every way that HEAD moves inside your repository (and it’s doing its job by preventing the automatic deletion of your commits).

Examine it with git reflog or git log -g. Nuke it with git reflog expire --expire=now --all, and then you can garbage collect the unused commits.