WSL compatibility for create-branch.sh

This commit is contained in:
Alpyne 2020-07-21 21:55:32 -07:00
parent f3183328f2
commit 613ea3d08c
1 changed files with 23 additions and 17 deletions

View File

@ -1,17 +1,23 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# USAGE: bash create-branch.sh <version> <branch_flags> # USAGE: bash create-branch.sh <version> <branch_flags>
# new branch gitcmd="git"
echo "Creating branch '$1'" if uname -r | grep Microsoft > /dev/null; then
git branch -D $1 || true echo WSL Detected: Using git.exe
git checkout $2 $1 gitcmd="git.exe"
git reset fi
echo "Committing changes..." # new branch
git add src echo "Creating branch '$1'"
git add client.txt $gitcmd branch -D $1 || true
git commit -m "Update to $1" $gitcmd checkout $2 $1
$gitcmd reset
echo "Pushing to origin..."
git push --force origin $1 echo "Committing changes..."
$gitcmd add src
$gitcmd add client.txt
$gitcmd commit -m "Update to $1"
echo "Pushing to origin..."
$gitcmd push --force origin $1