Last active
March 8, 2016 22:54
-
-
Save mrmachine/e33435c53a0ef9873b17 to your computer and use it in GitHub Desktop.
Short git status for current directory and all repos in `$VIRTUAL_ENV` directory.
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
git_status() { | |
STATUS=$(git status -s 2> /dev/null) | |
LOCAL=$(git rev-parse "@" 2> /dev/null) | |
UPSTREAM=$(git rev-parse "@{u}" 2> /dev/null) | |
if [[ -n $STATUS ]] || ([[ -n $UPSTREAM ]] && [[ $LOCAL != $UPSTREAM ]]); then | |
git status -bs | |
fi | |
} | |
venv_git_status() { | |
[[ ! -d "$VIRTUAL_ENV" ]] && return | |
DIR="$PWD" | |
for repo in $(find "$VIRTUAL_ENV" -type d -name .git); do | |
cd $(dirname "$repo") | |
if [[ -n $(git_status) ]]; then | |
echo | |
echo "$PWD" | |
git_status | |
echo | |
fi | |
done | |
cd "$DIR" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment