2020-11-14 01:05:51 +00:00
|
|
|
#!/bin/sh
|
2021-11-10 16:23:46 +00:00
|
|
|
# Remove the given branch locally and remotely.
|
|
|
|
# Without argument delete the current branch after switching to the default branch.
|
2020-11-14 01:05:51 +00:00
|
|
|
branch=${1:-$(git curbranch)}
|
2021-11-10 16:23:46 +00:00
|
|
|
echo "${@:-$branch}" | sed 's/\([^ ]\+\)/\1@{push}/g' |
|
|
|
|
xargs git rev-parse --abbrev-ref --revs-only | sed 's/\// /' |
|
|
|
|
xargs -L 1 --no-run-if-empty git push -d
|
|
|
|
test -n "$1" || git checkout main || git checkout master ||
|
|
|
|
git checkout $(cat "$(git rev-parse --git-path refs/remotes/origin/HEAD)" | sed 's|.*/||')
|
2021-01-23 18:51:23 +00:00
|
|
|
git branch -D "${@:-$branch}"
|