Skip to content

Instantly share code, notes, and snippets.

@wadouk
Last active January 2, 2018 08:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wadouk/fc33108c35463baa8a7cd6596a68ff84 to your computer and use it in GitHub Desktop.
Save wadouk/fc33108c35463baa8a7cd6596a68ff84 to your computer and use it in GitHub Desktop.
allow to execute a command in all subfolders that are git repos
if [ -d "$HOME/.userbin" ] ; then
for i in $(ls $HOME/.userbin/*); do source $i; done
fi
#!/usr/bin/env bash
function forall() {
export args="${@}"
find . -maxdepth 2 -name .git -print0 | xargs -0 -I {} sh -ca '
echo -e "\033[1;34m$(dirname {})\033[m " \
&& cd $(dirname {}) \
&& $args;
[ $? -ne 0 ] && echo "FAIL";
cd ..;
'
unset args;
}
remove_merged_granches() {
git branch --merged | egrep -v "(^\*|master|dev)" | xargs git branch -d
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment