【发布时间】:2018-08-13 08:02:18
【问题描述】:
我提交了一些不必要的代码,所以我使用了:
git reset HEAD~
我检查了文件并尝试推送我的最后一次提交(这是正确的)。但是,我收到错误:error: failed to push some refs to 'git@github.com:MyProject/MyProject.git'
hint: Updates were rejected because the tip of your current branch is behind
这可能是因为提交没有正确恢复,因为当我执行 git pull 时,提交又回来了。
如何正确还原此提交?
其他信息:git status 给我:
Your branch is behind 'origin/Mybranch' by 1 commit, and can be fast-forwarded.
【问题讨论】:
标签: git git-push git-pull git-reset