4

我想推送我的存储库的以前版本。如何将以前的变更集推送到 heroku?

就像是:

git push heroku 07226c49428354b09349ec45078122ce7c​​d410c8

谢谢!

编辑:一些试验

git branch -a 产生

master
remotes/heroku/master
remotes/origin/HEAD -> origin/master
remotes/origin/master

尝试类似的东西

git push heroku 07226c49428354b09349ec45078122ce7cd410c8:master

给我吗:

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.

我猜这是因为我当前的 heroku 部署是 HEAD,并且由于我想部署以前的变更集,git 会引发错误。所以我重新创建了新的heroku 堆栈(删除当前的heroku,删除它的引用,并创建一个新的heroku cedar 堆栈),并尝试再次推送特定的变更集。这一次,在一个空的 heroku 部署中,我得到:

错误:无法推送到不合格的目标:master 目标 refspec 既不匹配远程上的现有 ref,也不以 refs/ 开头,我们无法根据源 ref 猜测前缀。错误:未能将一些参考推送到 'git@heroku.com:empty-waterfall-8460.git'

任何想法如何在没有任何这些问题的情况下推动不同的变更集?或者我是否必须每次从特定变更集开始创建一个分支,重新创建 heroku 堆栈并推送该分支?

4

1 回答 1

0
git push heroku 07226c49428354b09349ec45078122ce7cd410c8:master

您可能希望为此提交创建一个分支或标签,以供将来参考。

编辑:我认为应该是:

git push -f heroku 07226c49428354b09349ec45078122ce7cd410c8:master

它解决了第一个错误。我不确定您重新创建堆栈后发生了什么。

于 2012-04-09T00:34:42.713 回答