Skip to content

Instantly share code, notes, and snippets.

@thinkingmedia
Created January 18, 2016 15:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thinkingmedia/f6c6d00238d58c1e025b to your computer and use it in GitHub Desktop.
Save thinkingmedia/f6c6d00238d58c1e025b to your computer and use it in GitHub Desktop.
Type `gitty` in a Windows prompt to add, commit and push with one command.
@ECHO OFF
git status
IF %ERRORLEVEL% NEQ 0 (EXIT /B -1)
git add --all
IF %ERRORLEVEL% NEQ 0 (EXIT /B -1)
IF "%~1"=="" GOTO END_BATCH
git commit -m %1
IF %ERRORLEVEL% NEQ 0 (GOTO END_BATCH)
FOR /f %%i IN ('git config --local remote.origin.url') DO SET URL=%%i
IF x%URL:thinkingmedia=%==x%URL% GOTO PUSH_CHANGES
SET /P AREYOUSURE=Push changes (Y/[N])?
IF /I "%AREYOUSURE%" NEQ "Y" GOTO END_BATCH
:PUSH_CHANGES
git push
:END_BATCH
@thinkingmedia
Copy link
Author

There is the option to check if the remote URL contains my username. If it does it prompts if the changes should be pushed. This is handy if you want to control when you push changes for a specific account.

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