Skip to content

Instantly share code, notes, and snippets.

@worldsayshi
Last active November 24, 2016 12:30
Show Gist options
  • Save worldsayshi/cac1e6ba8841d48ebac2 to your computer and use it in GitHub Desktop.
Save worldsayshi/cac1e6ba8841d48ebac2 to your computer and use it in GitHub Desktop.
Put this script in your working dir and run it at the end of the day to remind you what you've done (+ some other git useful commands)
#!/usr/bin/python
import os, fnmatch
# Some useful git commands to choose from:
reposNotCommited = 'git --no-pager log --branches --not --remotes --simplify-by-decoration --decorate --oneline'
logEntriesToday = 'git --no-pager log --since="6am"'
logEntriesLastSemester = 'git --no-pager log --since="2014-01-01" --until="2014-06-30" --oneline --author="Jon Doe"'
logEntriesThisWeek = 'git --no-pager log --since="last sunday"'
# The git command of your choice:
theGitCommand = logEntriesThisWeek
# Some terminal colors to choose from:
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
ENDC = '\033[0m'
basePath = os.getcwd()
# Walk the sub-directory tree and run the git command wherever we find a git repo
for root,dirs,files in os.walk("."):
for name in dirs:
if fnmatch.fnmatch(name,".git"):
os.chdir(root)
output = os.popen(theGitCommand).read()
if len(output)>0:
print ">> " + bcolors.HEADER + root + bcolors.ENDC
print bcolors.OKBLUE + output + bcolors.ENDC
os.chdir(basePath)
@worldsayshi
Copy link
Author

Updated it to include a few more command examples

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment