Last active
April 3, 2018 20:10
-
-
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
This file contains hidden or 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
#!/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