Last active
March 29, 2017 08:58
-
-
Save mfehr/4bc2b8100a3d13c8720aaac0fd2c35bc to your computer and use it in GitHub Desktop.
Git Status for whole Repository: Check if you have pushed all your changes and branches
This file contains 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 | |
git fetch --quiet | |
message="Does not exist on remote!" | |
all_remote_branches=$(git branch -r) | |
echo -e "\n\e[1m remote\tlocal\tbranch name\e[0m" | |
git branch | while read line ; do | |
output_line="" | |
branch_name=${line//"* "} | |
if [[ $all_remote_branches =~ .*origin\/$branch_name[[:space:]]+.* ]]; then | |
branch_status=$(git rev-list --left-right --count origin/${branch_name}...${branch_nam$ | |
output_line=" $branch_status\t" | |
if [[ $branch_status =~ .*0[[:space:]]+0.* ]]; then | |
echo -e "$output_line\e[32m${branch_name}\e[0m" | |
elif [[ $branch_status =~ .*[0-9][[:space:]]+0.* ]]; then | |
echo -e "$output_line\e[33m${branch_name}\e[0m" | |
else | |
echo -e "$output_line\e[31m${branch_name}\e[0m" | |
fi | |
else | |
echo -e " -\t-\t\e[31m${branch_name}\e[0m -> $message" | |
fi | |
done |
This file contains 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
alias gstrep='~/gstrep.sh' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment