从另一个本地分支推送到heroku

时间:2013-02-25 11:01:16

标签: ruby-on-rails git heroku

我有2个分支:development,some_other_name。我已经将some_other_name分支(这是开发的子分支)推送到heroku,我测试了我的代码然后切换到开发,在dev分支中做了一些代码更改,但是当我尝试将它推送到heroku时我得到了下一个:

To git@myapp.git
 ! [rejected]        development -> master (non-fast-forward)
error: failed to push some refs to 'git@myapp.git'
hint: Updates were rejected because a pushed branch tip is behind its remote
hint: counterpart. Check out this branch and merge the remote changes
hint: (e.g. 'git pull') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.

这意味着我必须将some_other_name分支合并到开发中。有没有办法不合并这些分支,而只推动开发呢?

2 个答案:

答案 0 :(得分:6)

是的,推送到heroku时可以使用--force选项执行此操作。

$ git push -f heroku development:master

答案 1 :(得分:0)

Heroku推荐的方法是使用命令的localbranch:master格式:

git push heroku-staging develop:master

--force可能有用,但也很危险。