From 9f389e0bf7d2cafba0b5837dc23dd2f9bb6ed8f9 Mon Sep 17 00:00:00 2001 From: Victor Westerlund Date: Sat, 20 Sep 2025 18:15:27 +0200 Subject: [PATCH] feat(git): add checkout git branch to gitf --- .bash_aliases | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.bash_aliases b/.bash_aliases index 0f4b7bb..9633fd1 100644 --- a/.bash_aliases +++ b/.bash_aliases @@ -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