Skip to content

Instantly share code, notes, and snippets.

@giseongeom
Created January 5, 2016 08:16
Show Gist options
  • Save giseongeom/d986db746dad8ec8a66a to your computer and use it in GitHub Desktop.
Save giseongeom/d986db746dad8ec8a66a to your computer and use it in GitHub Desktop.
cygwin 계열들의 rebase 작업 스크립트
@echo off
IF #%1# == ## (
GOTO :usage
) ELSE (
GOTO :selection
)
:selection
IF /I %1 == cygwin GOTO :cygwin
IF /I %1 == cygwin64 GOTO :cygwin64
IF /I %1 == msys32 GOTO :msys32
IF /I %1 == msys64 GOTO :msys64
echo.
echo Please enter correct argument.
echo.
GOTO :usage
:cygwin
call :shared
IF %ERRORLEVEL% NEQ 0 GOTO :EOF
c:\cygwin\bin\dash.exe -c '/usr/bin/rebaseall'
goto :done
:cygwin64
call :shared
IF %ERRORLEVEL% NEQ 0 GOTO :EOF
c:\cygwin64\bin\dash.exe -c '/usr/bin/rebaseall'
goto :done
:msys32
call :shared
IF %ERRORLEVEL% NEQ 0 GOTO :EOF
c:\msys32\usr\bin\dash.exe -c '/usr/bin/rebaseall'
goto :done
:msys64
call :shared
IF %ERRORLEVEL% NEQ 0 GOTO :EOF
c:\msys64\usr\bin\dash.exe -c '/usr/bin/rebaseall'
goto :done
:shared
(tasklist /nH /FI "IMAGENAME eq bash.exe" | findstr /i bash.exe > nul) && echo "bash is aleady running, canceling rebaseall...." && exit /b 255
echo.
echo. step1. rebaseall in progress ...........
exit /b 0
:done
echo.
echo. step2. rebaseall completed .............
echo.
goto :EOF
:usage
echo ---------------------------------------------------------------------
echo # Filename: %0
echo # Usage: %0 ^(cygwin^|cygwin64^|msys32^|msys64^)
echo #
echo ---------------------------------------------------------------------
@giseongeom
Copy link
Author

Usage)

C:\Users\giseong.eom>unix-rebase.cmd
---------------------------------------------------------------------
# Filename: unix-rebase.cmd
#    Usage: unix-rebase.cmd (cygwin|cygwin64|msys32|msys64)
#
---------------------------------------------------------------------

C:\Users\giseong.eom>unix-rebase cygwin
 step1. rebaseall in progress ...........
 step2. rebaseall completed .............

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment