e2faef48d6
- disabled git reset --hard - improved lno to conditionally use newlines - get git-dir appropriately
7 lines
413 B
Bash
Executable file
7 lines
413 B
Bash
Executable file
#!/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
|