这个问题似乎是一个相当标准的问题,是由远程分支和我推送到 git 的本地 CSS 文件之间的差异引起的。
我收到了标准错误消息“更新被拒绝,因为当前分支的尖端落后了。”好的不用担心。我使用了 git pull origin master ,然后——在 pull 之后——转移到我的 git Push 上。
推送成功到主分支,没有错误消息。认为一切都很棒,然后我使用 git push heroku master 并仅在推送到 Heroku 时收到错误:
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 status 看到工作目录是干净的(并且可能已附加 HEAD),但 Heroku 推送继续表明远程存在冲突/本地文件。
关于我需要做什么才能让它认识到 Heroku 的冲突已经得到解决,就像我对 Git 所做的那样,有什么想法吗?
编辑:我忘记分享一个细节。我已经使用 git checkout master 来确认我在 master 分支上,所以我们在那里肯定很好。
最佳答案
所以问题并不像我预期的那样是一个独立的头脑。就像马蒂厄提到的那样,我的错误在于认为我是最新的,因为原始存储库正在读取它已被提交/merge 。
因为 Heroku 是一个单独的 Remote ,看到我对原始 Remote 的 pull/推完全错过了重要的问题(因此我很困惑):Heroku Remote 是否已更新?
为此,我运行了 git push heroku master -f
,这使第二个 Remote 加快了速度,然后我们又开始工作了。
关于 pull/推失败后 Git 分离头,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30315926/