1

我使用以下三个命令将更改推送到现有应用程序,但更改未反映

$ 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.

并且没有任何更改反映在应用程序中

4

1 回答 1

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.

这将向您推荐更多的文档,在您的本地机器上或在线上可见。同样,如消息所示,a git pull(及其产生的合并)将解决此问题。

避免此问题的一种方法是使用变基工作流程而不是合并工作流程。在特性分支中进行开发,当你准备好合并时,拉主,重新设置特性分支,重新运行你的测试套件,然后合并。

另外,请阅读您的错误消息。

于 2012-10-17T05:36:16.917 回答