dotfiles/.local/bin/scripts/git-rebranch

7 lines
235 B
Plaintext
Raw Normal View History

#!/bin/sh
2022-11-09 17:52:27 +00:00
# Recreates the current or given branch with the state from main or another given branch.
branch=${1:-$(git curbranch)}
2022-11-09 17:52:27 +00:00
test "$(git curbranch)" = "$branch" && git switch ${2:-main}
git branch -D $branch
2022-11-09 17:52:27 +00:00
git switch -c $branch