【发布时间】:2021-08-17 11:01:23
【问题描述】:
我是 git 的新手。我正在做一个项目,但我使用了破坏我项目的新提交。
所以我使用 git log 和 git check out 回到上次提交。这在我的计算机上是成功的,但是当我尝试将它推送到 github 存储库时,我看到了这个错误:
error: failed to push some refs to 'https://github.com/bamdadghoori/courses.git'
hint: Updates were rejected because the remote contains work that you do
hint: not have locally. This is usually caused by another repository pushing
hint: to the same ref. You may want to first integrate the remote changes
hint: (e.g., 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
bamdad@DESKTOP-MJ4O8KO MINGW64 /e/courses (master)
这些是我尝试过的一些方法
1-重新初始化并使用新的提交
2-使用 git revert
【问题讨论】:
标签: git github git-push git-checkout git-revert