I would like to extract the information that is printed after a git status, which looks like:
git status
# On branch master # Your branch is ahead of \'origin/
Why wouldn't this work:
#!/bin/sh git diff origin/master..HEAD --quiet --exit-code RETVAL=$? if [ $RETVAL -gt 0 ]; then echo "You need to git push!" else echo "No git push necessary!" fi