#!/usr/bin/env bash

# USAGE: bash create-branch.sh <version> <branch_flags>

gitcmd="git"
if uname -r | grep Microsoft > /dev/null; then
    echo WSL Detected: Using git.exe
    gitcmd="git.exe"
fi

# new branch
echo "Creating branch '$1'"
$gitcmd branch -D $1 || true
$gitcmd checkout $2 $1
$gitcmd reset

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
