Rollback and Start Over/Pending Migration

137 Views Asked by At

I'm new to this so forgive me if I sound like an idiot.... In my Nitrous box i keep getting a Pending Migration Error. I run the bin/rake db:migrate RAILS_ENV=development, it persists. In the meantime I've tried git reset --hard HEAD to 'back out' but still getting it. Along the way I'm also getting other issues.

Can I delete or rollback the last few days worth of work and start over from where things weren't getting buggy? I git push and heroku push if that helps. I'm 3 weeks into this from Codermanual and would hate to start over, but if i have to i have to. Frustrated. Thanks for any of your advice!

1

There are 1 best solutions below

3
On

I am assuming that you have found the commit you wish to roll back to; let's call it ABC. Also, am assuming that you are working on a branch called my-branch. Start by checking out the commit and creating a new branch: git checkout ABC -b new-branchname.

At this point you can just ignore my-branch and do all of your future work on new-branchname. However, if you would like to do your future work on my-branch, continue with the following steps:

git reset --soft my-branch
git commit -m "Rolling back a bunch of commits"
git checkout my-branch
git merge new-branchname

At that point, your code is rolled back, and you can delete the branch you created (git branch -d new-branchname). What's nice is that if you change your mind and/or need some code from the rolled back commits, they are still in your history.