2013-04-08 97 views
6

要嘗試一個特性分支,我把它推到Heroku的主(因爲這是它使用爲您的網站的唯一分支機構),也就是我所做的:如何在您推送功能分支時將您的本地主分支推送到Heroku?

git push heroku feature-foo:master 

同時,我做了一些提交到我的本地主分支。現在,我希望把我的本地主人回給Heroku的,但我越來越:

To [email protected]:foo-repo.git 
! [rejected]  master -> master (non-fast-forward) 
error: failed to push some refs to '[email protected]:foo-repo.git' 
hint: Updates were rejected because the tip of your current branch is behind 
hint: its remote counterpart. Merge the remote changes (e.g. 'git pull') 
hint: before pushing again. 
hint: See the 'Note about fast-forwards' in 'git push --help' for details. 

這是有道理的,因爲確實Heroku的主人真的是我的特點,富分支,從而領先高手。但我不想從Heroku中拉出和合並 - 因爲這與合併我的feature-foo分支是一樣的,我不想這樣做。現在,我只是想推我的本地主沒有feature-foo提交。 (的確,我已經使用了heroku rollback,以便功能-foo的更改不在網站上生效。)

我該怎麼做?

回答

16

答案結果很簡單。進行強制推送,即

git push -f heroku master 
+2

是的,事實證明,git並不是一個特別好的部署工具。使用git部署到heroku通常涉及到你不想用真正的git倉庫來做的事情。 – Fitzsimmons 2013-04-08 18:31:41

0

您也可以在推出非主分支之前訪問您的網站heroku儀表板並回滾到之前的版本。

訪問dashboard.heroku.com/apps/your-app-goes-here/activity

一旦出現,你應該看到:

enter image description here 在構建點擊Roll back to here你想回去。一旦你回滾到正確的構建,你可以從主人推動,而不必使用武力。