I'm trying to build out a feature on an app, so I started a branch. I'm a couple hours into building my feature and now I realize that I have a mess. I generated a model and a bunch of changes, all I want now is to go back to my last commit and start over with a different approach. How can I delete all my changes and simply go back to the git repo head and start over schema and all?
Asked
Active
Viewed 1,232 times
0
-
If I do that I still have schema changes sticking around – Bitwise Apr 07 '16 at 17:26
-
1Did you migrate your database? If so, first rollback all relevant migrations, _then_ git reset hard. – Sergio Tulentsev Apr 07 '16 at 17:27
-
The nominated duplicate covers the git part of this question, but does not cover anything additional that should be done for Rails (see @SergioTulentsev's comment) – Wayne Conrad Apr 07 '16 at 19:40
1 Answers
1
reset hard - Make sure you are permanently deleting all the changes:
git log #get your last commit id
git reset --hard commit_id

dp7
- 6,651
- 1
- 18
- 37
-
-
1@CameronBass you need to rollback the migrations you have made. `rake db:migrate:down VERSION=
` – dp7 Apr 07 '16 at 17:38