2020-11-14 01:05:51 +00:00
|
|
|
#!/bin/sh
|
|
|
|
# Removes the given branch locally and remotely.
|
|
|
|
# With no argument it switches to the default branch and deletes the current branch.
|
|
|
|
branch=${1:-$(git curbranch)}
|
2021-07-27 11:20:42 +00:00
|
|
|
echo "${@:-$branch}" | sed 's/\([^ ]\+\)/\1@{push}/g' | xargs git rev-parse --abbrev-ref --revs-only | sed 's/\// /' | xargs --no-run-if-empty git push -d
|
2021-09-08 13:58:22 +00:00
|
|
|
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}"
|