ruby-on-rails - 重置 Heroku 上的意外更改

标签 ruby-on-rails ruby git heroku

我遇到了一个非常烦人的问题。我正在开发一个托管在 Heroku 上的 Rails 项目,其中央存储库托管在 Bitbucket 上。不幸的是,我无法访问 Linux 盒子,所以我一直在 Windows 中工作,这迫使我对项目进行各种更改(gem 版本等),以便让它在我的环境中运行本地环境。通常这不是什么大问题,只要我不将任何这些更改推送到 Heroku 或 Bitbucket 即可。然而,今天,我对 View 做了一些非常小的更改,以修复错误(总共 3 行),将这些小更改推送到 Bitbucket,然后犯了一个错误,即不小心将所有更改推送到 Heroku(以及一堆 Aptana 配置文件)。

所以我遇到的情况是,我在 Bitbucket 上有一个正确的代码库,一个(故意)搞砸了本地存储库,并且意外搞砸了 Heroku 服务器。为了尝试纠正这种情况,我将 Bitbucket 存储库克隆到一个全新的本地存储库中,然后尝试将其推送到 Heroku。当我这样做时,我收到一个错误,表明我的本地存储库落后了,所以我尝试用以下方法修复该问题:

git pull heroku master
git reset master XXXthe_commit_I_want_reflected_on_herokuXXX --hard
git push heroku master -f

不幸的是,当我这样做时,Heroku 现在无法构建。我的网站今天早上早些时候启动并运行,所以我知道旧的代码库功能齐全。我知道功能齐全的提交和我试图推送的提交之间的唯一变化是 View 中的 3 行,因此即使它们不是好的更改,也不应该破坏构建。我不知道现在是什么破坏了构建。

与此同时,我使用 Heroku 的 Web gui 回滚到上一个工作版本(在我推送 Windows hack 之前的版本),但我确实需要让它工作。有人可以帮忙吗?

这是我的 Heroku 构建日志

-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.2.0
-----> Installing dependencies using 1.9.7
   Ruby version change detected. Clearing bundler cache.
   Old: ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
   New: ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
   Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
   Fetching gem metadata from https://rubygems.org/.............
   Fetching version metadata from https://rubygems.org/...
   Fetching dependency metadata from https://rubygems.org/..
   Fetching git://github.com/Armor-Payments/armor_payments_ruby.git
   Fetching git://github.com/lacco/mailboxer.git
   fatal: Could not parse object 'd436329f771d1607a6835f0aeb8b1120a3562a47'.
   Git error: command `git reset --hard d436329f771d1607a6835f0aeb8b1120a3562a47`
   in directory
   /tmp/build_a5ee9a745f4daf14f284ecb5241f4bd2/vendor/bundle/ruby/2.2.0/bundler/gems/mailboxer-d436329f771d
   has failed.
   If this error persists you could try removing the cache directory
   '/tmp/build_a5ee9a745f4daf14f284ecb5241f4bd2/vendor/bundle/ruby/2.2.0/cache/bundler/git/mailboxer-2227b0f1f9bdf29f4822c250264b96e64ed63013'
   Bundler Output: Fetching gem metadata from https://rubygems.org/.............
   Fetching version metadata from https://rubygems.org/...
   Fetching dependency metadata from https://rubygems.org/..
   Fetching git://github.com/Armor-Payments/armor_payments_ruby.git
   Fetching git://github.com/lacco/mailboxer.git
   fatal: Could not parse object 'd436329f771d1607a6835f0aeb8b1120a3562a47'.
   Git error: command `git reset --hard d436329f771d1607a6835f0aeb8b1120a3562a47`
   in directory
   /tmp/build_a5ee9a745f4daf14f284ecb5241f4bd2/vendor/bundle/ruby/2.2.0/bundler/gems/mailboxer-d436329f771d
   has failed.
   If this error persists you could try removing the cache directory
   '/tmp/build_a5ee9a745f4daf14f284ecb5241f4bd2/vendor/bundle/ruby/2.2.0/cache/bundler/git/mailboxer-2227b0f1f9bdf29f4822c250264b96e64ed63013'
!
!     Failed to install gems via Bundler.
!
!     Push rejected, failed to compile Ruby app

最佳答案

为了将来引用,返回到上次部署的最快方法是通过:

$ heroku rollback 

此处的文档:https://devcenter.heroku.com/articles/releases#rollback

关于ruby-on-rails - 重置 Heroku 上的意外更改,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31575047/

相关文章:

ruby-on-rails - rails : rubocop disable Class has too many lines error

ruby - Ruby 中的 XSD 模式验证

git - 如何从 RTC Jazz 迁移到 Git?

git - Azure 集成源代码控制多个项目

ruby-on-rails - 能够在 Ruby on Rails 版本之间切换,一个来自 rbenv,另一个来自 rvm

javascript - Rails 远程 JavaScript

ruby - 配置 capybara 信任所有 SSL 证书

ruby - Aptana Studio 3.0.4 无法使用 RVM 找到 Ruby 可执行文件

git diff 忽略文件中的模式

mysql - 在 Rails 架构/事件记录中使用 "BIGINT UNSIGNED"