Skip to content

Instantly share code, notes, and snippets.

@hemanth
Created May 1, 2013 11:36
Show Gist options
  • Save hemanth/5494852 to your computer and use it in GitHub Desktop.
Save hemanth/5494852 to your computer and use it in GitHub Desktop.
git_notify
function cd() {
async() {
{
$2 $($1)
}&
}
notify_callback() {
[[ $1 > 0 ]] && echo "You have new stuff to pull!"
}
# If it's a git repo, check if we need to pull.
if git rev-parse --is-inside-work-tree &>/dev/null; then
async "git rev-list HEAD...origin/master --count" notify_callback
fi
builtin cd "$@"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment