Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ (Git) - cleared stash and recovered it [duplicate]

IDE : IntelliJ
I just clicked on the "clear" in the unstash window by mistake and lost a huge stash. Is there any way to get them back?

(Why is the question getting voted down when none of the solutions that people suggested helped me to recover from my problem. Is one suppose to ask only pedantic and pedagogical questions? )

like image 416
aadidasu Avatar asked May 15 '14 18:05

aadidasu


People also ask

Can you undo git stash clear?

There are two ways to restore work from the stash: Using git stash pop - The command restores the changes and schedules the stash for deletion. Using git stash apply - The command restores the changes but doesn't delete the stash from the ref.

How do I get my stashed changes back in Intellij?

From the main menu, choose Git | Uncommitted Changes | Unstash Changes. Select the Git root where you want to apply a stash, and make sure that the correct branch is checked out. Select the stash you want to apply from the list. If you want to check which files are affected in the selected stash, click View.

How do I revert back to git stash?

To retrieve changes out of the stash and apply them to the current branch you're on, you have two options: git stash apply STASH-NAME applies the changes and leaves a copy in the stash. git stash pop STASH-NAME applies the changes and removes the files from the stash.

Can I do git stash twice?

To reapply our stashed changes at a later point, we can use git stash apply . We can apply the stash entry to a different branch – it doesn't have to be the branch that we created the stash from.


1 Answers

I lost the stash. But since I was using IntelliJ all through for coding, it kept local history of all the file for almost 1 week.

How I recovered my files using IntelliJ? http://www.jetbrains.com/idea/webhelp/viewing-local-history-of-a-file-or-folder.html#

After that I created a patch (right click on file and time when you thought your changes were stashed) and carefully selected only those files that were modified by me.

Now apply the patch and you are good to go.

like image 154
aadidasu Avatar answered Oct 15 '22 18:10

aadidasu