使用git部署到heroku会因快进而被拒绝

我继续使用heroku + git获得以下失败…

$ heroku jammit:deploy --app XXXXXXXXXXX ===== Compiling assets...[OK] ===== Commiting assets...[OK] ===== Done... ===== Deploying assets for xxxxx-staging to heroku... To git@heroku.com:XXXXXXXX.git ! [rejected] master -> master (non-fast-forward) error: failed to push some refs to 'git@heroku.com:xxx-staging.git' To prevent you from losing history, non-fast-forward updates were rejected Merge the remote changes (eg 'git pull') before pushing again. See the 'Note about fast-forwards' section of 'git push --help' for details. [FAIL] ===== Done... ===== Deleting compiled assets...[OK] ===== Commiting deleted assets...[OK] ===== Done... $ git pull Already up-to-date. 

任何想法我做错了或应该采取不同的做法,以允许推动而不必强迫推?

谢谢

只需在每次推送时强制提交,即使有快进提交也会推送它。 我们一直在开发Heroku服务器中执行此操作,因为我们都在推送不同的提交(比其他提交更加落后)。

 git push -f git@heroku.com:picasso-staging.git 

我不使用jammit进行部署,但是你可能先用力推进然后再运行jammit任务。 或者检查一下jammit是否支持某种力推旗。

 git push -f REMOTE BRANCH:master #or just master 

强迫它! 将REMOTE替换为您的heroku远程名称( git remote -v以查看所有远程控制器)。 将BRANCH替换为您要推送的分支,或者只将“master”替换为主分支。

问题是已经推动了更改,并且您的提交已经落后于那些更新的推送。 我假设你有一个主分支和你的function分支,我们说它叫做my_feature 。 你可以做到这一点,没关系:

 git checkout master git pull git checkout my_feature git rebase master (you may have to fix some conflicts here, if any are found) git checkout master git merge my_feature git push heroku 

你应该记得运行任何测试,以确保一切都很好。