aboutsummaryrefslogtreecommitdiff
path: root/.local/bin
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2019-11-07 09:06:41 +0100
committerPatrick Spek <p.spek@tyil.nl>2019-11-07 09:06:41 +0100
commit565f3ec7ce2e7147081f755350073c267fb585b3 (patch)
tree3a92a02bbab1202e21917ffae392ed89a31a6e6e /.local/bin
parent28e20b21098eaa7d47e404e63f60772b6e9363d5 (diff)
Add bc for cleaning branches in git
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/git-branch-cleaning63
1 files changed, 0 insertions, 63 deletions
diff --git a/.local/bin/git-branch-cleaning b/.local/bin/git-branch-cleaning
deleted file mode 100755
index 8c728be..0000000
--- a/.local/bin/git-branch-cleaning
+++ /dev/null
@@ -1,63 +0,0 @@
-#! /usr/bin/env sh
-
-main()
-{
- # Handle opts
- opts "$@"
- shift "$OPTS"
- unset OPTS
-
- # Show help
- [ "$OPT_HELP_ONLY" ] && usage && exit 0
-
- # Get a list of branches
- buffer=$(mktemp)
-
- git branch --merged \
- | awk '{ print $NF }' \
- | grep -Ev "^master$" \
- > "$buffer"
-
- printf "Going to remove the following %s branches:\n" "$(wc -l < "$buffer")"
- cat -- "$buffer"
-
- printf "\n^C to cancel...\n"
- read
-
- while read -r branch
- do
- git branch -D -- "$branch"
- done < "$buffer"
-}
-
-opts()
-{
- OPTS=0
-
- while getopts ":h" opt
- do
- case "$opt" in
- h) OPT_HELP_ONLY=1 ;;
- *)
- printf "Invalid option passed: %s\n" "$OPTARG" >&2
- ;;
- esac
- done
-
- unset opt
-}
-
-usage()
-{
- cat <<EOF
-Usage:
- $(basename "$0") -h
-
-Clean up merged branches.
-
-Options:
- -h Show this help text and exit.
-EOF
-}
-
-main "$@"