From aee344fc2cfb5d0152d6fb97f77da08c2db33250 Mon Sep 17 00:00:00 2001 From: Eric Harding Date: Mon, 5 Aug 2019 14:54:05 -0400 Subject: [PATCH] make git_switch_linux switch to current branch if not specified --- tools/git_switch_linux.cmd | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/tools/git_switch_linux.cmd b/tools/git_switch_linux.cmd index a2f021edb..d63f38c8b 100644 --- a/tools/git_switch_linux.cmd +++ b/tools/git_switch_linux.cmd @@ -2,12 +2,15 @@ @setlocal SETLOCAL if "%SPARKVM_PORT%"=="" set SPARKVM_PORT=22 -if "%1" == "" goto :err +if "%1" == "" ( +for /F "tokens=2" %%m in ('git branch --points-at head') do set branch=%%m +) else ( +set branch=%1 +) echo. -ssh bts@sparkvm -p %SPARKVM_PORT% -o StrictHostKeyChecking=no -t "cd /home/bts/spark ; git reset --hard ; git clean -fd ; git checkout %1 ; git pull ; git submodule update" +echo branch=%branch% +ssh bts@sparkvm -p %SPARKVM_PORT% -o StrictHostKeyChecking=no -t "cd /home/bts/spark ; git reset --hard ; git clean -fd ; git checkout %branch% ; git pull ; git submodule update" ENDLOCAL goto :eof -:err -echo usage git_switch_linux [branch]