Skip to content

Instantly share code, notes, and snippets.

@alecthegeek
Forked from elecnix/git-croncheck
Created March 4, 2010 03:24
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 alecthegeek/321365 to your computer and use it in GitHub Desktop.
Save alecthegeek/321365 to your computer and use it in GitHub Desktop.
be notified when your repo is dirty
#!/bin/bash
# Put this in your crontab to be notified when your repo is dirty or commits needs to be pushed to a remote.
# Example crontab:
# MAILTO=user@yourdomain
# 0 * * * Mon-Fri /path/to/check-repo-status /path/to/repo
cd $1
git status | grep 'working directory clean' 2>/dev/null 1>/dev/null || {
git status
git diff
exit
}
git status | grep 'Your branch is ahead' 2>/dev/null 1>/dev/null && {
git status
git log origin/master..master
exit
}
@sehe
Copy link

sehe commented Apr 7, 2011

consider using grep -q instead of lengthy redirections

@alecthegeek
Copy link
Author

grep -q assumes GNU or other enhanced versions?

@sehe
Copy link

sehe commented Apr 7, 2011 via email

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