Skip to content

Commit 30d9237

Browse files
committed
Add git-merge-master
1 parent d1e2f7a commit 30d9237

File tree

3 files changed

+32
-2
lines changed

3 files changed

+32
-2
lines changed

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,11 @@ When your branch has had no intervening changes since it was branched from, reba
221221

222222
### git-rebase-branch
223223

224-
When your branch _does_ have intervening changes that cause it to differ from master, and commits have been applied to master that you want to be applied to your branch as well, this will do the job.
224+
When your branch _does_ have intervening changes that cause it to differ from master, and commits have been applied to master that you want to be applied to your branch as well, this will do the job. This script is formulated to minimize merge conflicts and "just work" most of the time by favoring the changes in the local branch over otherwise conflicting changes in master.
225+
226+
### git-merge-master
227+
228+
Merge master locally into your current branch, favoring the current branch's changes over master however. This avoids the duplicate "replay" of commits that can occur with rebasing.
225229

226230
### git-log
227231

git-merge-master.bat

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
@echo off
2+
3+
echo.
4+
echo.
5+
6+
git branch -a
7+
8+
echo.
9+
echo.
10+
echo Before continuing, be sure that you have switched to a branch
11+
echo *other than* master.
12+
echo.
13+
echo Merge master locally into this branch, favoring this branch's changes over master...
14+
pause
15+
echo.
16+
echo.
17+
18+
git merge -s recursive -X ours master
19+
20+
echo.
21+
echo.
22+
echo When you are ready to push your merged changes
23+
echo to the remote server, run "git-update"
24+
echo.
25+
echo.

git-rebase-branch.bat

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pause
1515
echo.
1616
echo.
1717

18-
git rebase master
18+
REM "Ours" and "theirs" mean the opposite of what they do during a straight merge
19+
git rebase -s recursive -X theirs master
1920

2021
echo.

0 commit comments

Comments
 (0)