Last active
August 27, 2021 19:32
-
-
Save johnloy/7a245618a2f7ef2f6f4a to your computer and use it in GitHub Desktop.
Check whether a git branch is clean
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
git_is_dirty() { | |
if [[ $(git status --porcelain 2> /dev/null | tail -n1) != "" ]] | |
then | |
echo 'ERROR: branch dirty' | |
exit 1 | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment