Skip to content

Instantly share code, notes, and snippets.

@mherchel
Last active September 24, 2015 18:16
Show Gist options
  • Save mherchel/dac6e1534527e2fbb894 to your computer and use it in GitHub Desktop.
Save mherchel/dac6e1534527e2fbb894 to your computer and use it in GitHub Desktop.
@echo off
::
:: Setup
::
:: 1. The remote computer must be networked with the local computer, and able to be accessed
:: using Windows File Sharing (SMB).
:: 2. Set the paths for the local and remote repository below, WITHOUT A LEADING SPACE
::
:: Directions for use
::
:: 1. Type "syncrepo to" (without the quotes) to sync the repo TO the remote.
:: 2. Type "syncrepo from" (without the quotes) to sync the repo FROM the remote.
set remoterepo=\\10.0.1.3\repo
set localrepo=C:\Users\username\sites\repo
:: For robocopy.exe options, see https://technet.microsoft.com/en-us/library/cc733145.aspx
:: Copy to the remote
if "%~1"=="to" (
robocopy /mir /copy:DAT /MT:500 /w:1 /v /log:reposync-to.log /tee /x %localrepo% %remoterepo% ^
/xf Thumbs.db *.log *.bat local.settings.php scss-lint-report.xml .DS_Store ^
/xd node_modules dist .sass-cache .vagrant .tmp bower_components
)
:: Copy FROM the remote
if "%~1"=="from" (
robocopy /mir /copy:DAT /MT:500 /w:1 /v /log:reposync-from.log /tee /x %remoterepo% %localrepo% ^
/xf Thumbs.db *.log *.bat local.settings.php scss-lint-report.xml .DS_Store ^
/xd node_modules dist .sass-cache .vagrant .tmp bower_components
)
:: No paramaters specified
if "%~1"=="" (
echo No input specified!
:: The following line contains three unicode characters that beep
echo   
goto end
)
:success
echo.
echo.
echo.
echo Done!
:: The following line contains a unicode character that beeps
echo 
:end
::unset variables
set remoterepo=
set localrepo=
echo and now a git status for you...
echo.
echo -------------------
echo.
git status
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment