Skip to content

Instantly share code, notes, and snippets.

@jflefebvre
Created August 15, 2014 21:31
Show Gist options
  • Save jflefebvre/a3299e0468e3a0f68495 to your computer and use it in GitHub Desktop.
Save jflefebvre/a3299e0468e3a0f68495 to your computer and use it in GitHub Desktop.
Scan all folders and extract git log if folder contains a git project and save the log file in gitlogs (put the scripts in your www containing all your projects folders)
#!/usr/bin/python
# -*- coding: utf-8 -*-
import fnmatch
import string
import os, sys, time
import subprocess
def isUnderGit():
curPath = os.getcwd()
if os.path.exists(curPath+'/.git'):
return True
else:
return False
base_path = os.getcwd()
os.chdir(base_path)
for f in os.listdir(base_path):
if os.path.isdir(os.path.join(base_path, f)):
curDir = os.path.join(base_path, f)
os.chdir(curDir)
#print curDir
isGitFound = isUnderGit()
if (isGitFound):
# print curDir
command = 'git --git-dir '+curDir+'/.git log > '+base_path+'/gitlogs/'+f+'.log'
print command
subprocess.Popen(command, stdout=subprocess.PIPE, shell = True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment