我使用以下三个命令将更改推送到现有应用,但更改未反映
$ git add .
$ git commit -m "changes"
# On branch master
# Your branch is ahead of 'origin/master' by 2 commits.
$ git push heroku master
我得到了:
To git@heroku.com:sleepy-oasis-7771.git ! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@heroku.com:sleepy-oasis-7771.git'
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
并且应用中未反映任何更改
答案 0 :(得分:2)
你的推动是! [rejected]
。这就是为什么没有变化生效的原因。
如消息所示:
To prevent you from losing history, non-fast-forward updates were rejected
Merge the remote changes (e.g. 'git pull') before pushing again. See the
'Note about fast-forwards' section of 'git push --help' for details.
这表示您可以在本地计算机或online上看到更多文档。同样,正如消息所示,git pull
(及其产生的合并)将解决此问题。
避免此问题的一种方法是使用rebase workflow而不是合并工作流程。在功能分支中进行开发,当您准备好合并时,请拉主控,重新设置功能分支,重新运行测试套件,然后然后合并。
另外,请阅读您的错误消息。