首页 > 解决方案 > git重置了,现在我无法推送

问题描述

在我执行“git reset hard”回到旧提交后我应该做什么?我在 heroku 上部署了一个站点,并且我的代码搞砸了,所以我只是做了一个“git reset,我从来没有做过。我在 VSCode 上的代码回到了我想要的方式,但是当我尝试做”git push origin master”或“git push heroku master”,它给了我hint: Updates were rejected because the tip of your current branch is behind hint: its remote counterpart. Integrate the remote changes (e.g. hint: 'git pull ...') before pushing again. hint: See the 'Note about fast-forwards' in 'git push --help' for details. 我试过查找它并弄乱了我发现的一些东西,但它真的让我感到困惑和陌生。我该如何推动这个旧版本的网站现在?

标签: git

解决方案


你需要用力推动它

git push -f origin master

如果你不喜欢强制推送到 master,你可以创建一个新的分支来推送,然后合并或做一个 PR。


推荐阅读