Skip to content

gh-pages merge from master branch.BAT (Usage: make a Windows shortcut to this (with empty "Start in:" field) and VOILA you can drag-and-drop your git repo folder! Even easier if you copy the shortcut into SendTo.)

License

Notifications You must be signed in to change notification settings

DarrenSem/gh-pages-merge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 

Repository files navigation

gh-pages-merge

gh-pages merge from master branch.BAT (Usage: make a Windows shortcut to this (with empty "Start in:" field) and VOILA you can drag-and-drop your git repo folder! Even easier if you copy the shortcut into SendTo.)

@echo off

CLS

SET "CD_OLD=%CD%"

echo.
echo +++ gh-pages merge from master branch

IF "%~1"=="" (
  echo.
  echo.Folder with git repo MUST be provided as 1st arg!
  goto aborted
)

echo.
echo.Launched from path:

echo.
echo.%CD_OLD%

rem Navigate to directory provided as argument
echo.
echo.cd "%~1"
cd "%~1"

IF ERRORLEVEL 1 (
  goto aborted
)

echo.
echo.Switched to path:

echo.
echo.%CD%

rem Ensure Git commands are accessible from cmd
rem set PATH=%PATH%;C:/Program Files/Git/cmd

rem Fetch all branches and commit information from remote repository
echo.
echo.git fetch origin
git fetch origin

IF ERRORLEVEL 1 (
  goto aborted
)

rem Display current branches and highlight the current branch
echo.
echo.git branch
git branch

echo.
echo +++ LAST CHANCE TO ABORT!

echo.
echo.Press CTRL+C to exit now, or any other key to proceed . . .
pause>NUL

rem Switch to gh-pages branch
echo.
echo.git checkout gh-pages
git checkout gh-pages

IF ERRORLEVEL 1 (
  goto aborted
)

rem Merge changes from the master branch
echo.
echo.git merge master
git merge master

IF ERRORLEVEL 1 (
  goto aborted
)

rem Push merged changes to remote repository
echo.
echo.git push origin gh-pages
git push origin gh-pages

IF ERRORLEVEL 1 (
  goto aborted
)

rem Switch back to master
echo.
echo.git checkout master
git checkout master

IF ERRORLEVEL 1 (
  goto aborted
)

echo.
echo.DONE. Press any key to exit . . .
goto pausequit



:aborted
  echo.
  echo.ABORTED. Press any key to exit . . .



:pausequit
  cd "%CD_OLD%"
  pause>NUL
  exit /b

About

gh-pages merge from master branch.BAT (Usage: make a Windows shortcut to this (with empty "Start in:" field) and VOILA you can drag-and-drop your git repo folder! Even easier if you copy the shortcut into SendTo.)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published