bin: Add -f/--force flag to git-branch-prune
This commit is contained in:
parent
1bbca5ac35
commit
6fe8b6a7f8
1 changed files with 26 additions and 1 deletions
|
|
@ -10,6 +10,24 @@ export USAGE='<remote>
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
POSITIONAL=()
|
||||||
|
FORCE=0
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
key="$1"
|
||||||
|
|
||||||
|
case $key in
|
||||||
|
-f|--force)
|
||||||
|
FORCE=1
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
POSITIONAL+=("$1")
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
set -- "${POSITIONAL[@]}"
|
||||||
|
|
||||||
case "$#" in
|
case "$#" in
|
||||||
0)
|
0)
|
||||||
remote='origin'
|
remote='origin'
|
||||||
|
|
@ -33,6 +51,13 @@ if [ -z "${pruned_branches}" ]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
vipe <<< "${pruned_branches}" | \
|
|
||||||
|
if [ "${FORCE}" -eq 1 ]; then
|
||||||
|
selector='cat'
|
||||||
|
else
|
||||||
|
selector='vipe'
|
||||||
|
fi
|
||||||
|
|
||||||
|
"${selector}" <<< "${pruned_branches}" | \
|
||||||
awk '{print $1}' | \
|
awk '{print $1}' | \
|
||||||
xargs git branch -D
|
xargs git branch -D
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue