Last active
August 29, 2015 14:19
-
-
Save harshays/d7308c4e67b866ec6cd1 to your computer and use it in GitHub Desktop.
Clean up your github directory
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Snippet to interactively view statuses and enter commands of all repositories in a Github folder | |
purpose is to clean up any lingering modifications/added files yet to be committed | |
''' | |
import os | |
dirname = os.path.dirname(os.path.realpath(__file__)) | |
folders = list(os.walk(dirname))[0][1] | |
folderspath = [os.path.join(dirname, f) for f in folders if not f.startswith(".")] | |
for folder in folderspath: | |
os.chdir(folder) | |
status = os.popen("git status").read() | |
if "up-to-date" in status: | |
continue | |
print "-"*10 | |
print "STATUS for %s \n" % folder.rsplit('/', 1)[-1] | |
os.system("git status"); | |
while True: | |
next_command = raw_input("enter command. enter 'no' to exit ->") | |
if next_command == 'no': | |
break | |
else: | |
os.system(next_command) | |
print '\n'*3 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment