johnloy
2/23/2016 - 9:10 PM

Shell Function to Check Whether a git Working Copy Has Changes

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
}