Skip to content

Instantly share code, notes, and snippets.

@arnolddevos
Created November 4, 2014 07:04
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arnolddevos/59dc41c77c21e7083dd5 to your computer and use it in GitHub Desktop.
Save arnolddevos/59dc41c77c21e7083dd5 to your computer and use it in GitHub Desktop.
Scan git repos and produce a time-sorted, consolidated log. (Hint: edit the variables in this.)
#! /bin/bash
# git-log-consolidate
set -e
SINCE="Aug 25"
UNTIL="Sep 19"
LOG=~/git-log-consolidated.log
TMP=$LOG.tmp
gather() {
set -e
XOX=$(basename $GIT_DIR)
if [ "$XOX" = ".git" ]
then XOX=$(basename $(dirname $GIT_DIR))
fi
git log --format=format:"%ai [XOX] %s" --since="$SINCE" --until="$UNTIL" | sed -e"s/XOX/$XOX/"
}
PROJECTS="current"
echo -n > $TMP
export GIT_DIR
for root in $PROJECTS
do
for d in $(find ~/projects/$root -type d -name objects)
do
GIT_DIR=$(dirname $d)
if [ -e $GIT_DIR/index ]
then
echo $GIT_DIR
gather >> $TMP
echo >> $TMP
fi
done
done
sort -u < $TMP > $LOG
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment