Skip to content

Instantly share code, notes, and snippets.

@devsdmf
Last active April 3, 2018 20:10
Show Gist options
  • Save devsdmf/ad1063542bc91e2b71ac5a438f84feca to your computer and use it in GitHub Desktop.
Save devsdmf/ad1063542bc91e2b71ac5a438f84feca to your computer and use it in GitHub Desktop.
Bash function to check if a git repository is clean [of changes] or dirty
#!/bin/bash
function is_repo_dirty {
local dir=$(pwd)
[[ -n $1 ]] && dir=$1
[[ -n $(git status --porcelain 2> /dev/null | tail -n1) ]] && return
false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment