如何重置 Heroku 应用程序并重新提交所有内容?

发布于 2024-11-09 03:21:58 字数 583 浏览 1 评论 0原文

我正在构建一个应用程序,我也在 Heroku 中测试该应用程序。我今天遇到了一些问题,不得不回滚本地 git 存储库中的一项提交,但 Heroku 现在不会识别我的更改,并表示“一切都是最新的”。

因此,运行

git push heroku master

heroku 的响应

Everything up-to-date

是不正确的。

更新:我尝试过的事情

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

对源代码做了一些更改,然后

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(9

三生路 2024-11-16 03:21:59

听起来很奇怪。也许尝试推送不同的分支可以吗?

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

我希望您测试创建一个新的生产分支。此外,拥有一个可用于部署的生产分支是件好事。

如果它不起作用,那么我认为问题更加严重,您需要 heroku 的帮助。

编辑:
还要添加 heroku 版本插件。回滚就像heroku rollback一样简单

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

嘿哥们儿 2024-11-16 03:21:59

这并不适用于所有情况,但是如果您的本地存储库与 Heroku 存储库有所不同,以至于 git 无法弄清楚如何协调两者——就像您在将本地分支推送到 Heroku 后重新建立了基础——您可以通过在 ref 前放置一个加号 + 来强制推送,如下所示:

git push heroku +master

它可能不适用于您的情况,但值得一试。

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.

暖心男生 2024-11-16 03:21:59

这对我有用(来自 https://coderwall.com/p/okrlzg):

  1. 运行 heroku plugins:install https ://github.com/ltoll/heroku-repo.git
  2. heroku repo:reset -a APPNAME

从那里,git 存储库已被“重置”。接下来,运行:

  1. git push heroku master -a APPNAME

来播种 git 存储库并重新部署您的应用程序。

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.

禾厶谷欠 2024-11-16 03:21:59

假设您回滚了一项远程提交,该提交是以前存在的。我认为你应该:

git merge heroku/master

如果你只是想继续前进

或者:

git push --force heroku master

如果你想推动变革

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

江城子 2024-11-16 03:21:59

我曾经遇到过类似的问题,并通过更改代码中的一个字符并再次运行 git add/commit/push 来解决它。我想你已经尝试过了。

不要破坏应用程序,只需向 CSS 文件或其他文件添加注释,看看是否有效,

祝你好运

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

﹎☆浅夏丿初晴 2024-11-16 03:21:59

我遇到了同样的问题,并通过

Git Push origin HEAD:master

解决了它,为您提供

Git Push heroku HEAD:master

I had same problem and solved it by

Git push origin HEAD:master

For you

Git push heroku HEAD:master

少女的英雄梦 2024-11-16 03:21:59

一段时间后,我开始使用像这样的 rake 任务 deploy.rake

它将标准化并加快速度up 部署,尤其是在应该实施迁移时

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

如您所见,选项 --force (或 -f)用于任何推送,以便忽略与 heroku 的 git 存储库的任何冲突

但我不推荐新手使用:)

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 :)

星軌x 2024-11-16 03:21:59

我遇到了同样的问题,我尝试了所有的建议,但没有帮助。我必须在本地运行资产预编译并推送,即使我做了 heroku run rake assets:precompile

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

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
小姐丶请自重 2024-11-16 03:21:59

当您上传启动的新版本(slug)时,您的heroku应用程序将自动重置。如果您的应用程序的更改方式导致其无法启动,您的应用程序dynos将继续运行旧版本。

换句话说,当您部署应用程序时,它将 slug(新源代码)加载到新的测功机中,如果测功机正确加载应用程序,它将让该测功机替换运行应用程序的当前测功机。

这可能是您看不到任何变化的问题...

如果您有来自 git push heroku 的日志,请发布它们。

编辑:
git reset 处理 git 索引,而不是工作树或当前分支。

你必须让他们检查你重置的提交以实际更改文件——这如何与heroku交互,我不太确定(还没有回滚到heroku的部署,祈祷),但希望它有所帮助。也许尝试在结帐后执行 git push heroku

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文