Skip to content

Instantly share code, notes, and snippets.

@ethaizone
Created October 18, 2013 06:58
Show Gist options
  • Save ethaizone/7037514 to your computer and use it in GitHub Desktop.
Save ethaizone/7037514 to your computer and use it in GitHub Desktop.
Commit git with bat file
@echo off
echo type "commit" or "update"
cd "curl"
set GIT_PATH="C:\Program Files (x86)\Git\bin\git.exe"
set BRANCH = "origin"
:P
set ACTION=
set /P ACTION=Action: %=%
if "%ACTION%"=="c" (
%GIT_PATH% add -A
%GIT_PATH% commit -am "Auto-committed on %date%"
%GIT_PATH% pull %BRANCH%
%GIT_PATH% push %BRANCH%
)
if "%ACTION%"=="u" (
%GIT_PATH% pull %BRANCH%
)
if "%ACTION%"=="exit" exit /b
goto P
@echo off
echo type "commit" or "update"
cd "curl"
set TGIT_PATH="C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe"
:P
set ACTION=
set /P ACTION=Action: %=%
if "%ACTION%"=="c" (
%TGIT_PATH% /command:commit /logmsg:"Auto-committed on %date%" /closeonend:3
%TGIT_PATH% /command:pull /closeonend:3
%TGIT_PATH% /command:push /closeonend:3
)
if "%ACTION%"=="u" (
%TGIT_PATH% /command:pull /closeonend:3
)
if "%ACTION%"=="exit" exit /b
goto P
@echo off
echo type "commit" or "update"
cd "curl"
set GIT_PATH="C:\Program Files (x86)\Git\bin\git.exe"
set TGIT_PATH="C:\Program Files\TortoiseGit\bin\TortoiseGitProc.exe"
set BRANCH = "origin"
:P
set ACTION=
set /P ACTION=Action: %=%
if "%ACTION%"=="c" (
%TGIT_PATH% /command:commit /logmsg:"Auto-committed on %date%" /closeonend:3
%GIT_PATH% pull %BRANCH%
%GIT_PATH% push %BRANCH%
)
if "%ACTION%"=="u" (
%GIT_PATH% pull %BRANCH%
)
if "%ACTION%"=="exit" exit /b
goto P
@ethaizone
Copy link
Author

Hello
how we can run git command from cmd.exe?

If you install git windows version from https://git-scm.com/downloads, it should have git command included already.

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