Last active
October 4, 2019 20:52
-
-
Save lucaspar/6b133ad427fc4eac969d47e2b71345ec to your computer and use it in GitHub Desktop.
[ SCR ] Identifies uncommitted changes in git projects
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 | |
# Detects all git directories and run their status to identify uncommited changes | |
declare -a dirs=("projects" "work") | |
# runs git status in directory in argument | |
gitstatus () { | |
echo -e "\e[1;35m>>> GIT MONITOR :: " $1 "\e[0m\n" | |
cd $1 | |
cd .. | |
git status | |
printf "\n\n" | |
return 0 | |
} | |
export -f gitstatus | |
# iterate directories array looking for .git directories | |
echo -e "\e[1;32mChecking for uncommitted changes in these dirs: ${dirs[@]} \e[0m\n" | |
for i in "${dirs[@]}" | |
do | |
find ~/$i -type d -name ".git" -print | xargs -n 1 -I {} bash -c 'gitstatus "$@"' _ {} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment