1

Several months ago I did a refactoring of paths to several java modules. Now it seems that I have forgotten to move the src/test directory of one of the modules and instead deleted it...

How can I recover all these deleted files? Note that the path to the module where the files was located, is deleted, and I cannot remember the earlier path?

jactor-rises
  • 2,395
  • 2
  • 22
  • 44

1 Answers1

0

As explained in this answer you can find the last commit where the file/folder was modified with this command:

git log --full-history -- src/test

Once you find the commit where the file exists you can checkout it into your current working tree with as explained here:

git checkout <SHA>^ -- <path-to-file>

Note that <SHA> is the hash of the commit where the folder was deleted, so you make a checkout to the previous commit

Francisco Puga
  • 23,869
  • 5
  • 48
  • 64