dotfiles/dot_config/zsh/functions/gdone

16 lines
379 B
Bash

# vim: ft=zsh
# Update and switch to master and delete current branch
current=$(git branch --show-current)
if [ "$current" == "$(git_main_branch)" ]; then
echo "Cannot delete $(git_main_branch) branch"
return 1
fi
git fetch --all --prune --jobs=10
git branch -f $(git_main_branch) origin/$(git_main_branch)
git switch $(git_main_branch)
git branch -D $current
unset current