feat(git): add checkout git branch to gitf

This commit is contained in:
Victor Westerlund 2025-09-20 18:15:27 +02:00
parent b43ef009d6
commit 9f389e0bf7
Signed by: vlw
GPG key ID: D0AD730E1057DFC6

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