Skip to content

Instantly share code, notes, and snippets.

@kogakure
Created February 4, 2009 15:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kogakure/58137 to your computer and use it in GitHub Desktop.
Save kogakure/58137 to your computer and use it in GitHub Desktop.
Python: Git maintenance scripts
#!/usr/bin/python
import os
import os.path
from subprocess import call
if __name__ == "__main__":
apps_dir = os.path.abspath('.')
for app_name in os.listdir(apps_dir):
app_dir = os.path.abspath(os.path.join(apps_dir, app_name))
git_path = os.path.join(app_dir, '.git')
if os.path.lexists(git_path):
print ""
print "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"
print ""
print "%s" % app_dir
os.chdir(app_dir)
call(['git', 'fsck'])
else:
continue
#!/usr/bin/python
import os
import os.path
from subprocess import call
if __name__ == "__main__":
apps_dir = os.path.abspath('.')
for app_name in os.listdir(apps_dir):
app_dir = os.path.abspath(os.path.join(apps_dir, app_name))
git_path = os.path.join(app_dir, '.git')
if os.path.lexists(git_path):
print ""
print "* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *"
print ""
print "%s" % app_dir
os.chdir(app_dir)
call(['git', 'gc'])
else:
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment