Skip to content

Instantly share code, notes, and snippets.

@ku1ik
Created September 28, 2011 10:19
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 ku1ik/1247581 to your computer and use it in GitHub Desktop.
Save ku1ik/1247581 to your computer and use it in GitHub Desktop.
#!/bin/bash
## MOVED TO https://github.com/sickill/git-dude
INTERVAL=30
ICON_PATH=`pwd`/icon.png
export LC_ALL=C # make sure git talks english
while [ 1 ]; do
for dir_name in *; do
if [[ -d $dir_name ]]; then
repo_name=$(basename $dir_name .git)
cd $dir_name
CHANGES=$(git fetch -v 2>&1 | grep -F -- '->')
while read -r line; do
case $line in
*..*)
commit_range=$(echo "$line" | awk '{ print $1 }')
branch_name=$(echo "$line" | awk '{ print $2 }')
commit_messages=$(git log $commit_range --pretty=format:'%s (%an)')
notify-send -i $ICON_PATH "New commits in $repo_name/$branch_name" "$commit_messages"
;;
*new*)
branch_name=$(echo "$line" | awk '{ print $4 }')
notify-send -i $ICON_PATH "New branch $repo_name/$branch_name"
;;
esac
done <<< "$CHANGES"
cd - &>/dev/null
fi
done
sleep $INTERVAL
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment