1

I have made some changes to master branch without commit just shelved those changes and then accidently deleted those shelved changes. Is there any possibility of recovering those shelved changes ?

rocks
  • 180
  • 16
  • Do you mean "stashed" as in `git stash save`? And you did a `git stash clear`? – Schwern Jul 13 '17 at 07:01
  • 1
    I found this in the docs; perhaps it helps: https://git-scm.com/docs/git-stash#git-stash-Recoveringstashesthatwerecleareddroppederroneously – Cristian Lupascu Jul 13 '17 at 07:03
  • I have integrated git in androidstudio, shelved those changes and deleted. didnt use any stash commands – rocks Jul 13 '17 at 07:08
  • @Schwern Android Studio has a "shelf" menu item that is distinct from "stash" with git integration. I have never used it as I prefer to make sure everything is in Git and not something else. – Code-Apprentice Jul 13 '17 at 07:21
  • Unfortunately, [this question + answer](https://stackoverflow.com/questions/39497445/android-studio-shelved-changes-disappeared-not-even-in-the-idea-shelf-director) seem to indicate that changes were not stored in `git`. Try looking for `android-studio` specific hacks, or run some disk recovery tool on your system. – LeGEC Jul 13 '17 at 08:18

2 Answers2

2

I know this thread is 11 month old but I think this should be mentioned, even if it's a bit off topic. In Android Studio, there is a "Shelf" tab in Version Control tool window where you can right click and "Unshelve" your files.

FerFig
  • 113
  • 9
-1

Since shelving appears to add the item to the object database, so that it can be unshelved later, yes it is recoverable.

When you run git add, or stash or shelve an item, git actually places the object in the object database. It's now unreferenced and will eventually be garbage collected. But until then you can use a tool called git-recover to find that in your object database and recover it.

Edward Thomson
  • 74,857
  • 14
  • 158
  • 187