aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2022-07-14 19:19:09 -0300
committerEuAndreh <eu@euandre.org>2022-07-14 19:26:11 -0300
commit1c60444ba66db5249f31e19fc01ecf35be4ccabc (patch)
treeeab3528a6d3c96b6d1d6f3a565483c2ea880664a
parent0ac6cdd807cfcde0fd0c54a9ca7b827d3b0ee620 (diff)
downloadwebsite-main.tar.gz
pastebin: Auto-add _pastebins/2022-07-14-git-cleanup-command.mdHEADmain
-rw-r--r--_pastebins/2022-07-14-git-cleanup-command.md70
1 files changed, 70 insertions, 0 deletions
diff --git a/_pastebins/2022-07-14-git-cleanup-command.md b/_pastebins/2022-07-14-git-cleanup-command.md
new file mode 100644
index 0000000..52cd17f
--- /dev/null
+++ b/_pastebins/2022-07-14-git-cleanup-command.md
@@ -0,0 +1,70 @@
+---
+
+title: git-cleanup command
+
+date: 2022-07-14
+
+layout: post
+
+lang: en
+
+ref: git-cleanup-command
+
+---
+
+```
+#!/bin/sh
+set -eu
+
+usage() {
+ cat <<-'EOF'
+ Usage:
+ git cleanup
+ git cleanup -h
+ EOF
+}
+
+help() {
+ cat <<-'EOF'
+
+ Options:
+ -h, --help show this message
+ EOF
+}
+
+for flag in "$@"; do
+ case "$flag" in
+ --)
+ break
+ ;;
+ --help)
+ usage
+ help
+ exit
+ ;;
+ *)
+ ;;
+ esac
+done
+
+while getopts 'h' flag; do
+ case "$flag" in
+ h)
+ usage
+ help
+ exit
+ ;;
+ *)
+ usage >&2
+ exit 2
+ ;;
+ esac
+done
+shift $((OPTIND - 1))
+
+
+
+git branch --merged |
+ grep -v -e '^\*' -e '^. main$' |
+ xargs git branch -d
+```