Faizan Anwer Ali
Faizan Anwer Ali

Reputation: 671

How to download Heroku slug?

I used GitHub to upload to Heroku and somehow by mistakes those commits are deleted from GitHub and my source code. I'm back to my old code and have lost some work.

I tried to restore using How can I download my code from Heroku but because I didn't use Heroku Git instead I used GitHub one and those commits are now deleted I can download it even via Heroku slug plugin. They are giving me old commits.

I knew I should've make a zip file backup before doing something stupid playing with Git. Those were production files and I've no backup. Only files are now deployed to Heroku is working. but Heroku slug plugin is giving me old files with are present as commit on GitHub not deleted one.

How can I download Heroku current slug files?

Upvotes: 1

Views: 1764

Answers (3)

Faizan Anwer Ali
Faizan Anwer Ali

Reputation: 671

None of the answer work. Turns out I was working in wrong branch.

Initially I worked on another branch then I did something, God knows what, I moved to master brach and my commits get deleted from github and I was moved to master branch which didn't have the latest code

So I moved to branch which I was working.

git checkout <another branch>

And there it was, all my latest code.

I moved to master branch.

git checkout master

I stashed the master branch changed.

git stash

I reset the master branch HEAD with my another branch

git reset --hard <another branch>

Then push all files to master branch on github.

git add -A
git commit -m "Recovered Files"
git push origin master --force

Upvotes: 0

amer
amer

Reputation: 1672

Maybe you want to rollback to that version and them pull it down locally ?

  1. check heroku releases to check the version you wish to rollback to
  2. heroku rollback v10 10 is the older version of your choice
  3. git log --reflog to see view and copy your commit id
  4. git checkout commit id

  5. heroku git:clone -a APP-NAME to download current version

Upvotes: 0

GomuGomu
GomuGomu

Reputation: 314

heroku plugins:install heroku-slugs

Then this

heroku slugs:download -a Your App name

Upvotes: 5

Related Questions