From 960e4410f76801356ebd42801c914b2910a302a7 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Mon, 18 Nov 2024 08:21:58 -0300 Subject: v0 migration to mkwb --- src/content/pastebins/2022/07/14/git-cleanup.adoc | 70 +++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 src/content/pastebins/2022/07/14/git-cleanup.adoc (limited to 'src/content/pastebins/2022') diff --git a/src/content/pastebins/2022/07/14/git-cleanup.adoc b/src/content/pastebins/2022/07/14/git-cleanup.adoc new file mode 100644 index 0000000..52cd17f --- /dev/null +++ b/src/content/pastebins/2022/07/14/git-cleanup.adoc @@ -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 +``` -- cgit v1.2.3