为了尝试一个功能分支,我将它推送到Heroku的主人(因为那是它用于你网站的唯一分支),即我做了:
git push heroku feature-foo:master
Run Code Online (Sandbox Code Playgroud)
与此同时,我向我当地的主分公司做了一些提交.现在我想把我的本地主人推回Heroku,但我得到了:
To git@heroku.com:foo-repo.git
! [rejected] master -> master (non-fast-forward)
error: failed to push some refs to 'git@heroku.com: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.
Run Code Online (Sandbox Code Playgroud)
这是有道理的,因为Heroku的主人确实在我的feature-foo分支上,因此领先于master.但是我不想从Heroku中提取和合并 - 因为这与合并我的feature-foo分支是一样的,我不想这样做.现在,我只想在没有feature-foo提交的情况下推送我的本地主人.(事实上,我已经使用过,heroku rollback因此功能foo更改不会在网站上发布.)
我怎么做?
Gho*_*r21 16
答案结果很简单.做强迫推,即
git push -f heroku master
Run Code Online (Sandbox Code Playgroud)