Recovering lost IntelliJ IDEA shelved changesets

Imagine the following scenario:

  • You are moving your beloved project out from a subdirectory of an svn repository, into it’s own brand spanking new repository.
  • You have about 3 days worth of large refactorings to the codebase waiting in the wings, with most of the tests passing, but not quite ready for commit to the trunk
  • You use IDEA’s shelve feature to put those changes into safe keeping, so you can make changes and commits to the repository in preparation for the move
  • You manage to successfully migrate the svn repository across, managing to keep all the history (yay)
  • You then open the new (and renamed) project in IDEA, and all of your shelved changes are gone

Gulp.

Luckily, IDEA never deletes any of the shelved changesets, and conveniently stores them in unified .diff format in $USERDIR$.IntelliJIdea80configshelf

Also, conveniently, there’s the ‘Version Control -> Apply Patch’ menu item, so you don’t have to worry about mucking about with the *nix patch command line tool.

Day saved. Hurrah!

** Perhaps this sort of thing is a good argument for using a Distributed VCS system, like git or mercurial or monotone et al. You would normally be doing lots of small commits to your local repository, without necessarily worrying about breaking trunk for everybody, and your changes stay safe

8 comments

Skip to comment form

    • Thomas on August 6, 2010 at 8:56 pm
    • Reply

    Thanx – this trick just made my day. Don’t you just love when IDEA saves your ass?

    • Wendy Schmitz on January 26, 2012 at 2:38 am
    • Reply

    Awesome tip! Made my day too!

    • Henning on April 24, 2012 at 11:09 pm
    • Reply

    Danke Mann!

    • michal on November 1, 2012 at 11:19 pm
    • Reply

    Saved my two days!! Thanks a lot

  1. Life saver! I hoped that IDEA would have squirreled them away somewhere, but I had no idea where. Thanks!

      • joff on October 14, 2014 at 11:19 am
        Author
      • Reply

      Glad I could be of help 🙂

      I’ve since taken my own advice, and I now use git for everything!

    • Guni on November 5, 2015 at 6:36 pm
    • Reply

    Thank you very much – however, for me, the shelved items was stored in:
    /.idea/shelf/

    Thanks anyway (-:

    • Zolee on July 9, 2016 at 8:27 am
    • Reply

    I loce you man, you saved my ass! Recovered 2 days of work thanks to you!

Leave a Reply

Your email address will not be published.