Skip to content

Instantly share code, notes, and snippets.

@gatamar
Created December 4, 2018 12:23
Show Gist options
  • Save gatamar/34d17fc66ea07660ee0e9ff0c9852d51 to your computer and use it in GitHub Desktop.
Save gatamar/34d17fc66ea07660ee0e9ff0c9852d51 to your computer and use it in GitHub Desktop.
from subprocess import call
# git diff --name-only --diff-filter=D > deleted_files_list.txt
folder_name = "SubFolder1/SubFolder2"
with open("deleted_files_list.txt") as f:
for filename in f:
if filename.startswith("folder_name"):
call(["git", "checkout", filename[:-1]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment