Honestly, you should be ashamed that this hasn't been source controlled sooner. Tsk tsk tsk.
17 lines
316 B
Bash
Executable file
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
|