[英]Git Updates were rejected because the tip of your current branch (main) is behind BUT branch is up to date?
"The tip of your current branch is behind its remote counterpart" means that there have been changes on the remote branch that you don't have locally. “您当前分支的尖端位于其远程分支的后面”意味着远程分支上发生了您在本地没有的更改。 And Git tells you to import new changes from REMOTE and merge it with your code and then push it to remote. Git 会告诉你从 REMOTE 导入新的更改并将其与你的代码合并,然后将其推送到远程。
However, I have tried everything and get the message that everything is up to date但是,我已经尝试了一切,并得到了一切都是最新的信息
Though I am not able to do push to Heroku with an update anymore as I keep getting the message:虽然我无法再通过更新推送到 Heroku,因为我不断收到消息:
Git Updates were rejected because the tip of your current branch is behind Git 更新被拒绝,因为您当前分支的尖端落后
I tried git push --force origin main我试过 git push --force origin main
Tried pulling and merging尝试拉和合并
Even did a hard reset but absolutely nothing works and I need to deploy the API changes to Heroku but to no avail.甚至进行了硬重置,但绝对没有任何效果,我需要将 API 更改部署到 Heroku,但无济于事。 Can anyone help me get unstuck please?有人可以帮我解开吗?
Check if you have multiple remote repositories declared in your local project, with:检查您是否在本地项目中声明了多个远程存储库,其中:
git remote -v
And look at the graph of commits in order to visually see those remote commits that you might not have locally:并查看提交图,以便直观地查看您在本地可能没有的那些远程提交:
git log --decorate --graph --oneline --all --branches
That way, you will know which remote/branch you need to reset to.这样,您将知道需要重置到哪个远程/分支。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.