Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save radoslav-stefanov/a18bbc3fb0fa8804734f7a57f3bb655d to your computer and use it in GitHub Desktop.
Save radoslav-stefanov/a18bbc3fb0fa8804734f7a57f3bb655d to your computer and use it in GitHub Desktop.

Revisions

  1. @joakin joakin revised this gist Oct 8, 2021. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion git-find-me-the-fucking-deleted-file.sh
    Original file line number Diff line number Diff line change
    @@ -4,4 +4,4 @@ git log --diff-filter=D --summary | grep delete
    # Find the commits that involved that path
    git log --all -- some/path/to/deleted.file
    # Bring the file back to life to the current repo (sha commit of parent of commit that deleted)
    g co shaofthecommitthatdeletedthefile^ -- some/path/to/deleted.file
    git checkout shaofthecommitthatdeletedthefile^ -- some/path/to/deleted.file
  2. @joakin joakin created this gist Mar 25, 2015.
    7 changes: 7 additions & 0 deletions git-find-me-the-fucking-deleted-file.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,7 @@
    # If you don't remember the exact path/name, search the log for deleted files
    git log --diff-filter=D --summary | grep delete
    # Find the file you want to get from the ouput, and use the path
    # Find the commits that involved that path
    git log --all -- some/path/to/deleted.file
    # Bring the file back to life to the current repo (sha commit of parent of commit that deleted)
    g co shaofthecommitthatdeletedthefile^ -- some/path/to/deleted.file