forked from Special-K-s-Flightsim-Bots/DCSServerBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswitch-branch.cmd
More file actions
35 lines (31 loc) · 873 Bytes
/
switch-branch.cmd
File metadata and controls
35 lines (31 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
@echo off
setlocal EnableDelayedExpansion
:: Get the directory of the script file
set script_dir=%~dp0
set script_dir=%script_dir:~0,-1%
cd /d "%script_dir%"
:: Get current branch from .git/HEAD
for /f "tokens=2 delims= " %%a in ('type .git\HEAD') do set branch=%%a
:: Trim the branch name
set branch=%branch:refs/heads/=%
@REM echo Current branch: %branch%
:: Switch to the other branch
if "%branch%" == "master" (
choice /c yn /n /m "Switch to development branch? [Y/N] "
if ERRORLEVEL 2 (
echo Operation aborted.
goto :eof
)
git checkout development
call update.cmd
) else if "%branch%" == "development" (
choice /c yn /n /m "Switch to master branch? [Y/N] "
if ERRORLEVEL 2 (
echo Operation aborted.
goto :eof
)
git checkout master
call update.cmd
) else (
echo Unknown branch: %branch%
)