pull/推失败后 Git 分离头

标签 git heroku github

这个问题似乎是一个相当标准的问题,是由远程分支和我推送到 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/

相关文章:

node.js - Node JS、Redis 和 Heroku

github - 如何将彩色文本放入 githubs README.md 或 Index.md 文件中

git - 在 Jenkins 中,如何将项目 check out 到特定目录(使用 GIT)

git - 如何找到以前的 merge 提交

git - 错误 : src refspec master does not match any. 无法将某些引用推送到 heroku

git - 快速解决与 --theirs 的 GIT merge 冲突

heroku - 在 Heroku 上有什么好的页面缓存替代方案?

github - Github Atom 编辑器中单个窗口上的多个项目

git - 修改一个git rebase

git - 测量 git blob 对象大小的正确方法是什么