2020-11-14 02:05:51 +01: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-04-21 19:51:14 +02:00
|
|
|
echo "${@:-$branch}" | sed 's/\([^ ]\+\)/\1@{push}/g' | xargs git rev-parse --abbrev-ref --revs-only | sed 's/\// /' | xargs git push -d
|
2021-02-16 13:11:05 +01:00
|
|
|
test $1 || git checkout main 2>/dev/null || git checkout master || git checkout $(cat .git/refs/remotes/origin/HEAD | cut -d'/' -a)
|
2021-01-23 19:51:23 +01:00
|
|
|
git branch -D "${@:-$branch}"
|