Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function gitLocalCleanup() {
- # loop through results of git branch
- # cut removes the * from checked out branch
- # grep regex allows for alphanumeric with dash and/or underscore
- for x in `git branch | cut -c 3- | grep -e "[\-\_0-9A-Za-z]*"`;
- do
- echo "Delete $x? (y/n)";
- read confirm;
- if [[ "$confirm" == "y" ]];
- then
- git branch -d $x; # use -D if you want force delete
- fi;
- git gc --auto;
- done;
- }
- export -f gitLocalCleanup;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement