Skip to content

Instantly share code, notes, and snippets.

@johnloy
Last active August 27, 2021 19:32
Show Gist options
  • Save johnloy/7a245618a2f7ef2f6f4a to your computer and use it in GitHub Desktop.
Save johnloy/7a245618a2f7ef2f6f4a to your computer and use it in GitHub Desktop.
Check whether a git branch is clean
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