mirror of
https://codeberg.org/vlw/dotfiles.git
synced 2025-11-05 01:12:42 +01:00
feat(git): add checkout git branch to gitf
This commit is contained in:
parent
b43ef009d6
commit
9f389e0bf7
1 changed files with 12 additions and 0 deletions
|
|
@ -83,6 +83,18 @@ gitf () {
|
||||||
gitf w
|
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)
|
# Clear local branches that have no upstream on remote (cleanup)
|
||||||
"c")
|
"c")
|
||||||
git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D
|
git fetch -p && git branch -vv | awk '/: gone]/{print $1}' | xargs git branch -D
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue