Reputation: 730
I've deployed an app to heroku and want to reload that source code and work from there again and blow away all changes I've made since. Is there a way to do a git reset --head [heroku-source]? I know I can get the source with a heroku git:clone -a myapp
but I would like to know if there's a more efficient way.
After I pushed to Heroku, I kept making changes and never pushed to Git. So my cleanest code is there.
Upvotes: 0
Views: 1761
Reputation: 30083
I'm assuming your changes are all on the master
branch, and you have that branch checked out before you start.
Make sure you have a Heroku git remote:
heroku git:remote
Check out a new branch, so that you don't lose your changes if something goes wrong:
git branch recent-changes
Fetch from the Heroku remote, this will create or update a remote tracking branch called heroku/master
that contains the current state of the master branch on Heroku:
git fetch heroku
Look at what's changed between master
and heroku/master
, and make sure you really want to throw those changes away:
git log heroku/master..master
Reset your local master
branch back to wherever the heroku/master
branch is up to:
git reset --hard heroku/master
Upvotes: 1
Reputation: 3999
You can simply
git reset --hard heroku/master
where heroku
is the name of the heroku remote origin. You can view your remote branches with
git branch -r
Upvotes: 1