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 ?
Asked
Active
Viewed 1,819 times
1
-
Do you mean "stashed" as in `git stash save`? And you did a `git stash clear`? – Schwern Jul 13 '17 at 07:01
-
1I 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 Answers
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
-
Android Studio has a "Shelf" menu item/command in its VCS integration. I do not have any idea how it is implemented and do not use it since I just use the git integration and its stash command. I just know that this exists and is probably what the OP is referring to. – Code-Apprentice Jul 13 '17 at 07:22
-
-
didn't work, recovered some files in the branch other than the expected file – rocks Jul 13 '17 at 08:58
-
Sorry to hear that. I'll have to figure out where "shelving" _does_ put its files. – Edward Thomson Jul 13 '17 at 09:00