Heroku回滚并拉出旧版本

时间:2018-08-07 14:20:58

标签: ruby-on-rails heroku rollback

我在代码中犯了一个错误,并将其推送到heroku master。我无法在本地代码中识别出问题。我对以前的版本进行了heroku rollback的操作-它起作用了,并且先前的版本在heroku上可见。

但是我在努力获取代码(heroku clone:app name给了我一个旧代码)。我尝试heroku releases来获取发布编号,然后将其用于git pull heroku af5c366b,但是却出现了错误:

  

致命:找不到远程引用af5c366b

如何还原代码?

我现在已经完全进入Heroku了。

1 个答案:

答案 0 :(得分:0)

您应该能够简单地运行...

$ git checkout af5c366b

通过此有用的消息,您应该将自己带入“分离的头脑”状态。

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b <new-branch-name>

签出分支后,可以将该分支合并到master中。

$ git checkout master
$ git merge new-branch-name