Skip to content

Instantly share code, notes, and snippets.

@jharmn
Last active August 29, 2015 14:24
Show Gist options
  • Save jharmn/209b53f8342ec7c89e6d to your computer and use it in GitHub Desktop.
Save jharmn/209b53f8342ec7c89e6d to your computer and use it in GitHub Desktop.
Find all subdirectories not initialized in git
from subprocess import check_output, CalledProcessError, STDOUT
from os import walk
for dir in walk('.').next()[1]:
try:
result = check_output('/usr/bin/git rev-parse --is-inside-work-tree', shell=True, stderr=STDOUT, cwd=dir)
except CalledProcessError:
print dir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment