-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgh-pages merge from master branch.bat
112 lines (81 loc) · 1.5 KB
/
gh-pages merge from master branch.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
@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