Skip to content

Instantly share code, notes, and snippets.

@kernoeb
Created August 12, 2020 12:01
Show Gist options
  • Save kernoeb/86e96ff131aa4265d9c5a843419d13cb to your computer and use it in GitHub Desktop.
Save kernoeb/86e96ff131aa4265d9c5a843419d13cb to your computer and use it in GitHub Desktop.
Get all git status in a directory, only if something's changed
#!/bin/bash
# Example :
# dir/
# | - repo1
# | - repo2
grepmsg="rien à valider" # if french
print_equals () {
for ((i=0; i<=$(($1*2)); i++)); do printf =; done
}
print_spaces () {
for ((i=0; i<=$(($1/2)); i++)); do printf " "; done
}
for d in *
do
(if [ -d "$d/.git" ]
then
cd $d
if ! git status | grep -q "$grepmsg"
then
nb=${#d}
echo -e "\e[1m\e[92m"
print_equals $(($nb+1))
echo
print_spaces $nb
echo -e "$d"
print_equals $(($nb+1))
echo -e "\e[0m"
git status
echo
fi
fi);
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment