Reputation: 671
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
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
Reputation: 1672
Maybe you want to rollback to that version and them pull it down locally ?
heroku releases
to check the version you wish to rollback toheroku rollback v10
10 is the older version of your choicegit log --reflog
to see view and copy your commit idgit checkout commit id
heroku git:clone -a APP-NAME
to download current version
Upvotes: 0
Reputation: 314
heroku plugins:install heroku-slugs
Then this
heroku slugs:download -a Your App name
Upvotes: 5