-
-
Save alecthegeek/321365 to your computer and use it in GitHub Desktop.
be notified when your repo is dirty
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 | |
} |
grep -q assumes GNU or other enhanced versions?
On 04/07/2011 01:12 PM, alecthegeek wrote:
grep -q assumes GNU or other enhanced versions?
<shame>GNU</shame>
so true
me and my assumptions :)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
consider using
grep -q
instead of lengthy redirections