8 lines
413 B
Plaintext
8 lines
413 B
Plaintext
|
#!/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)}
|
||
|
git push -d $(git rev-parse --abbrev-ref $branch@{push} | sed 's/\// /' || echo origin $branch)
|
||
|
test $1 || git checkout main || git checkout master || git checkout $(cat .git/refs/remotes/origin/HEAD | cut -d'/' -f4)
|
||
|
git branch -D $branch
|