Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我不小心将不想的东西推送到存储库。我按照此处的步骤操作,但尽管它确实还原了代码,但仍然有一个我希望删除的日志:
澄清一下,我希望事情就像提交 1a869f3c6d 之后的一切都没有发生过一样。
我对托管此存储库的服务器具有完全访问权限,因此我可以在必要时手动修改一些配置文件。而且我不知道这是否真的相关,但正在使用的 git 服务器是 Go Git Service。
免责声明:我理解为什么我可能不想这样做。如果您只想回答为什么这是一个坏主意,请不要。
要退出 master 上的最新提交,请使用git reset --hard:
git reset --hard
git checkout master git reset --hard master~1 git push -f
或者,如果您知道要master指向的提交:
master
git reset --hard 1a869f3c6d