How to reset Heroku app and re-commit everything?

Ruby on-Rails-3GitHeroku

Ruby on-Rails-3 Problem Overview


I'm building an application which I'm also testing in Heroku. I ran into some problem today and had to rollback one commit in my local git repo, but Heroku now won't recognize my changes saying that "everything is up to date".

So, running

git push heroku master

heroku responds with

Everything up-to-date

which isn't true.

UPDATE: Things I've tried

git push -f heroku master
git push --force heroku master
git push heroku +master
git push --force heroku +master

Did some changes in the source code and then

git add.
git commit -a -m "Message" #(Then this commit shows in my git explorer)
git push heroku master #Everything up-to-date

Ruby on-Rails-3 Solutions


Solution 1 - Ruby on-Rails-3

Sounds weird. Maybe try pushing a different branch would do?

git branch production
git checkout production
#do some code changes
git commit -am "some desperate code changes to try fix heroku"
git push heroku production:master

Creating a new production branch is what I want you to test. Besides, it's nice to have a production branch that you can use to deploy.

If it doesn't work, then I think the problem runs deeper and you need help from heroku.

EDIT: Add the heroku releases addon too. Rolling back is as easy as heroku rollback

Solution 2 - Ruby on-Rails-3

This doesn't work in all situations, but if your local repo has diverged from the Heroku repo such that git can't figure out how to reconcile the two -- like if you rebased your local branch after it was pushed to Heroku -- you can force a push by putting a plus sign + before the ref, like this:

git push heroku +master

It may not work in your case, but it's worth a try.

Solution 3 - Ruby on-Rails-3

This worked for me (from https://coderwall.com/p/okrlzg):

  1. Run heroku plugins:install https://github.com/lstoll/heroku-repo.git
  2. heroku repo:reset -a APPNAME

From there, the git repository has been "reset". Next, run:

  1. git push heroku master -a APPNAME

to seed the git repository and re-deploy your app.

Solution 4 - Ruby on-Rails-3

Supposing you rolled back one commit you remotely did, that previously existed. I think you should make:

git merge heroku/master

If you just want to go forward

or:

git push --force heroku master

if you want to push that change

Solution 5 - Ruby on-Rails-3

I once had a similar problem and solved it by changing one char in my code and running git add/commit/push again. I imagine you've already tried that though.

Don't break the app, just add a comment to a CSS file or something and see if that does the trick

good luck

Solution 6 - Ruby on-Rails-3

I had same problem and solved it by

Git push origin HEAD:master

For you

Git push heroku HEAD:master

Solution 7 - Ruby on-Rails-3

After a while I came up to use rake task like this one deploy.rake

It will standardize and speed up deployment especially when migrations should be implemented

puts `git push -f [email protected]:#{APP}.git #{current_branch}`

As you see, option --force (or -f) is used for any push in order to ignore any conflicts with heroku's git repo

But I don't recommend it for newcomers :)

Solution 8 - Ruby on-Rails-3

I had the same problem and I tried all the suggestions and didnot help. I had to run assets precompile locally and push, even though I did heroku run rake assets:precompile.

rake assets:precompile
git add .
git commit -am "local assets precompile"
git push heroku master

Solution 9 - Ruby on-Rails-3

Your heroku app will automatically reset when you upload a new version (slug) that boots. If the change you app in a way that makes it not boot, your apps dynos will continue to run the old version.

In other words, when you deploy your app, it loads the slug (new source code) into a new dyno, and if the dyno loads the app properly, it will have that dyno replace the current dynos running your app.

This might be your problem in not seeing any change...

If you have logs from the git push heroku please post them.

Edit: git reset deals with the git indexes and not the working tree or current branch.

You have to them checkout the commit you reset to actually change the files-- how this interacts with heroku, I'm not so sure (never having rolled back a deploy to heroku yet, fingers crossed), but hope it helps. Maybe try doing a git push heroku after your checkout?

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionbbonaminView Question on Stackoverflow
Solution 1 - Ruby on-Rails-3omaView Answer on Stackoverflow
Solution 2 - Ruby on-Rails-3Rob DavisView Answer on Stackoverflow
Solution 3 - Ruby on-Rails-3Jeremy ThomasView Answer on Stackoverflow
Solution 4 - Ruby on-Rails-3txomonView Answer on Stackoverflow
Solution 5 - Ruby on-Rails-3stephenmurdochView Answer on Stackoverflow
Solution 6 - Ruby on-Rails-3DahuchaoView Answer on Stackoverflow
Solution 7 - Ruby on-Rails-3Sergiy SeletskyyView Answer on Stackoverflow
Solution 8 - Ruby on-Rails-3underScorePassionFruitView Answer on Stackoverflow
Solution 9 - Ruby on-Rails-3colinrossView Answer on Stackoverflow