Files
fish-config/functions/branch.fish
T
rootiest 6722deea3c feat: add git and history utility functions
- Add branch, fc, and gitup functions
- Update README documentation for new functions and abbreviations
- Remove obsolete push-vim function
2026-04-29 17:23:13 -04:00

15 lines
426 B
Fish

function branch --description 'Switch to or create a git branch'
if not git rev-parse --is-inside-work-tree >/dev/null 2>&1
echo "Not a git repo."
return 1
end
# Check if the branch already exists locally
if git show-ref --verify --quiet refs/heads/$argv[1]
git checkout $argv
else
# If it doesn't exist, create it
git checkout -b $argv
end
end