Skip to content

Instantly share code, notes, and snippets.

@nerr
Created June 11, 2014 10:10
Show Gist options
  • Save nerr/a3f706248b1403b66e7c to your computer and use it in GitHub Desktop.
Save nerr/a3f706248b1403b66e7c to your computer and use it in GitHub Desktop.
git操作菜单批处理脚本(For Windows)
@echo off
:: color 17
:: title
@title git batch
:: check
:check
cls
echo. =-=-=-=-=git status=-=-=-=-=
call git status
:: menu
:menu
echo. =-=-=-=-=action menu=-=-=-=-=
echo. 0 Status
echo. 1 Add
echo. 2 Commit
echo. 3 Add ^& Commit
echo. 4 Add ^& Commit ^& Push
echo. 5 Push
echo. 6 Pull
echo. 7 Show Last 10 log
echo. 9 Exit
echo.
echo. please enter your choice:
set /p selected=
if "%selected%"=="0" goto check
if "%selected%"=="1" goto add
if "%selected%"=="2" goto commit
if "%selected%"=="3" goto addcommit
if "%selected%"=="4" goto addcommitpush
if "%selected%"=="5" goto push
if "%selected%"=="6" goto pull
if "%selected%"=="7" goto showlog
if "%selected%"=="9" goto exit
:add
cls
echo. =-=-=-=-=git add .=-=-=-=-=
call git add .
pause
goto check
:commit
cls
echo. =-=-=-=-=git commit -m=-=-=-=-=
echo. input commit message:
set /p committext=
call git commit -m "%committext%"
pause
goto check
:addcommit
cls
echo. =-=-=-=-=git commit -a -m=-=-=-=-=
echo. input commit message:
set /p committext=
call git commit -a -m "%committext%"
pause
goto check
:addcommitpush
cls
echo. =-=-=-=-=git add commit push=-=-=-=-=
echo. input commit message:
set /p committext=
call git commit -a -m "%committext%"
goto push
pause
goto check
:push
cls
echo. =-=-=-=-=git push=-=-=-=-=
call git push
pause
goto check
:pull
cls
echo. =-=-=-=-=git pull=-=-=-=-=
call git pull
pause
goto check
:showlog
cls
echo. =-=-=-=-=show log=-=-=-=-=
call git log -n 10 --pretty=oneline
pause
goto check
:exit
echo. =-=-=-=-=bye~=-=-=-=-=
echo. By Leon Zhuang @Nerrsoft
echo. leon@nerrsoft.com
echo. http://nerrsoft.com
:: GitBatch
:: 0.1.1
:: 2012.2.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment