-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Rob Patro
committed
Sep 24, 2020
1 parent
7c61961
commit 1fdf79b
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
if [ $# -eq 0 ] | ||
then | ||
echo "No input arguments provided. Usage is merge_into_develop.sh <branch_to_merge_in>" | ||
exit 1 | ||
fi | ||
|
||
feature=$1 | ||
|
||
# from https://stackoverflow.com/questions/173919/is-there-a-theirs-version-of-git-merge-s-ours | ||
# in case branchA is not our current branch | ||
git checkout develop | ||
|
||
# make merge commit but without conflicts!! | ||
# the contents of 'ours' will be discarded later | ||
git merge -s ours ${feature} | ||
|
||
# make temporary branch to merged commit | ||
git branch branchTEMP | ||
|
||
# get contents of working tree and index to the one of branchB | ||
git reset --hard ${feature} | ||
|
||
# reset to our merged commit but | ||
# keep contents of working tree and index | ||
git reset --soft branchTEMP | ||
|
||
# change the contents of the merged commit | ||
# with the contents of branchB | ||
git commit --amend | ||
|
||
# get rid off our temporary branch | ||
git branch -D branchTEMP | ||
|
||
# verify that the merge commit contains only contents of branchB | ||
git diff HEAD ${feature} |