从git存储库中删除重复的数据库迁移 [英] Removing duplicate db migrations from git repository
问题描述
我试图在Heroku上部署一个Rails应用程序,并且遇到了一些基本的git问题。我是新来的这个所有 - rails,git,heroku - 所以我害怕我迷失在什么可能是一个相当基本的概念。
我已将应用程序推送到Heroku,但是当我迁移数据库($ heroku rake db:migrate)时,我不断收到以下错误:
rake中止!
多次迁移的名称为CreateFavorites
检查我的github存储库,果然,两次迁移:
20101007030431_create_favorites.rb
20101012173735_create_favorites.rb
第一个文件 - 20101007030431_create_favorites.rb - 在我的本地应用程序中不存在,但它在我提交后仍在github存储库中。
预先感谢。
如果你输入git status,它应该显示不一致。它会这样说:
#在分支大师
#已更改但未更新:
# (使用git add / rm< file> ...更新将要提交的内容)
#(使用git checkout - < file> ...放弃工作目录中的更改)
#
#deleted:db / migrate / 20101007030431_create_favorites.rb
那里的指示。要永久地将其从存储库中删除,请键入:
git rm db / migrate / 20101007030431_create_favorites.rb
I'm trying to deploy a rails app to Heroku and I'm running into some basic git problems. I'm new to this all -- rails, git, heroku -- so I'm afraid I'm getting lost on what's probably a fairly basic concept.
I've pushed the app to Heroku, but when I'm migrating the db ($ heroku rake db:migrate), I keep getting the following error:
rake aborted!
Multiple migrations have the name CreateFavorites
Checking my github repository, and sure enough, there are two migrations:
20101007030431_create_favorites.rb
20101012173735_create_favorites.rb
The first file -- 20101007030431_create_favorites.rb -- does not exist in my local app, and yet it's still in the github repository after I commit. How can I remove this file and get my repository and local app in sync?
Thanks in advance.
If you type "git status" it should show the inconsistency. It will say something like this:
# 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
So just follow the instructions there. To permanently remove it from the repository, type:
git rm db/migrate/20101007030431_create_favorites.rb
这篇关于从git存储库中删除重复的数据库迁移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!