git - 更新被拒绝是因为你当前分支的提示落后了?

标签 git github

<分区>

我的故事:

我正在做一个项目,不小心我将所有更改都提交到 Github,但这不是问题,我使用了

git reset --soft HEAD~1

一切都在本地解决了,现在我试图再次将其推送到 Github 但我总是收到此消息:

error: failed to push some refs to 'https://github.com/dr-coder/Chat-App.git'
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.

如何返回我的 Github 仓库以再次推送状态??

最佳答案

因为你是唯一一个在 repo 上工作的人,你可以做一个:

git-push --force

如果不是,您可以使用以下方法恢复旧的更改:

git checkout -b old-state COMMIT

这将创建一个分支,其中包含您要恢复到的提交。

关于git - 更新被拒绝是因为你当前分支的提示落后了?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63107532/

相关文章:

git - 临时 merge 其他分支到我当前的分支

git - 反之亦然如何将HDFS中的文件获取/复制到Git存储库中?

Github疑问-同步repo

python - GIT 钩子(Hook) -> Python -> Bash : How to read user input?

git - 无法将某些引用推送到 'https://github.com/myname/myrepo'

jquery - 如何在 github 存储库的子文件夹中搜索特定单词或条目

javascript - 注销 npm 的 GitHub Packages

git - 如何保存git“正在重新设置基准”?

git - 撤消 git pull,如何将 repos 恢复到旧状态

linux - 使用 git pull 在/var/www/vhosts 上的网络服务器上进行部署