Search code examples
ruby-on-railsgitheroku

What does heroku repo:reset not delete the source code in the Heroku repository?


If I do heroku repo:reset --app appname, after making me enter the appname again, then it seems to do a reset. But if I run heroku run bash --app appname and then do an ls command, all my source code still appears to be there. According to this heroku page, this command should delete all my appname source code on heroku. Why is this not happening?


Solution

  • You're misunderstanding what this command does.

    If you deploy to Heroku using git push, you push into a Git repository owned by Heroku. When that happens, Heroku builds an application slug:

    Slugs are compressed and pre-packaged copies of your application optimized for distribution to the dyno manager. When you git push to Heroku, your code is received by the slug compiler which transforms your repository into a slug. Scaling an application then downloads and expands the slug to a dyno for execution.

    Your application runs from the application slug, not the raw source code.

    heroku repo:reset resets the underslying Git repository. It does nothing to the compiled slug, nor does it scale your dynos. If you try to clone your app, you should find that the remote repository is empty.

    You can view the url of the Git repository using git remove -v. If you use heroku run bash you can see the files that were compiled into your application slug at build time.

    It's not totally clear what you want to do, but you might be looking for heroku apps:destroy, but be aware that this will permanently destroy an app.