从git存储库中删除重复的数据库迁移

iam*_*mur 12 migration git ruby-on-rails github heroku

我正在尝试将一个rails应用程序部署到Heroku,我遇到了一些基本的git问题.我对这一切都很陌生 - rails,git,heroku - 所以我担心我会迷失在可能是一个相当基本的概念上.

我已经将应用程序推送到Heroku,但是当我迁移数据库($ heroku rake db:migrate)时,我不断收到以下错误:

rake aborted!
Multiple migrations have the name CreateFavorites
Run Code Online (Sandbox Code Playgroud)

检查我的github存储库,果然,有两个迁移:

20101007030431_create_favorites.rb
20101012173735_create_favorites.rb
Run Code Online (Sandbox Code Playgroud)

第一个文件 - 20101007030431_create_favorites.rb - 在我的本地应用程序中不存在,但在我提交后它仍然在github存储库中.如何删除此文件并使我的存储库和本地应用程序同步?

提前致谢.

Ben*_*Lee 22

如果键入"git status",则应显示不一致.它会说这样的话:

# On branch master
# Changed but not updated:
#   (use "git add/rm <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       deleted:    db/migrate/20101007030431_create_favorites.rb
Run Code Online (Sandbox Code Playgroud)

所以请按照那里的说明操作.要从存储库中永久删除它,请键入:

git rm db/migrate/20101007030431_create_favorites.rb
Run Code Online (Sandbox Code Playgroud)