peter-nixos/scripts/git-switch-to-branch
Benson Chu fd0f029e99 Let there be light!
Honestly, you should be ashamed that this hasn't been source
controlled sooner. Tsk tsk tsk.
2024-01-26 08:07:20 -06:00

17 lines
316 B
Bash
Executable file

#!/usr/bin/env sh
BRANCH=$1
if [ -n "$BRANCH" ]
then
if [ $(git branch -l) | grep $BRANCH]
git stash -u
git checkout -b "$BRANCH"
git stash pop
else
git stash -u
git switch -c "$BRANCH"
git stash pop
fi
else
echo "Error: Branch name not specified"
fi