How to reset Heroku app and re-commit everything?

旧城冷巷雨未停 提交于 2019-12-28 07:39:11

问题


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

回答1:


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




回答2:


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.




回答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.




回答4:


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




回答5:


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




回答6:


I had same problem and solved it by

Git push origin HEAD:master

For you

Git push heroku HEAD:master




回答7:


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 git@heroku.com:#{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 :)




回答8:


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



回答9:


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?



来源:https://stackoverflow.com/questions/6104258/how-to-reset-heroku-app-and-re-commit-everything

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!