feat(git): add checkout git branch to gitf (#47)

Reviewed-on: https://codeberg.org/vlw/dotfiles/pulls/47
This commit is contained in:
Victor Westerlund 2025-09-20 18:16:21 +02:00
parent 50b98443c7
commit f0bf01386b

View file

@ -83,6 +83,18 @@ gitf () {
gitf w
;;
# Checkout [and create] a git branch (defaults to "master")
"b")
local branch="${2:-master}"
if git show-ref --verify --quiet refs/heads/"$branch"; then
git checkout $branch
return 0
fi
git checkout -b $branch
;;
# Clear local branches that have no upstream on remote (cleanup)
"c")
git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D