Last active
December 23, 2015 03:39
-
-
Save cool-RR/6575042 to your computer and use it in GitHub Desktop.
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
#!bash | |
if [ -n "$2" ]; then | |
export SOURCE=$1 ; | |
export DESTINATION=$2 ; | |
else | |
export SOURCE=HEAD ; | |
export DESTINATION=$1 ; | |
fi | |
export GIT_INDEX_FILE=`git rev-parse --show-toplevel`/.git/aux-merge-index ; | |
export GIT_WORK_TREE=`create_temporary_folder gm_`; | |
echo $GIT_INDEX_FILE | |
trap 'rm -f '"'$GIT_INDEX_FILE'"'; rm -rf '"'$GIT_WORK_TREE'" 0 1 2 3 15 ; | |
mkdir $GIT_WORK_TREE/.git | |
set -e ; | |
git read-tree -im `git merge-base $DESTINATION $SOURCE` $DESTINATION $SOURCE ; | |
#echo Finished read-tree | |
#sleep 1000 | |
git merge-index git-merge-one-file -a | |
#echo Finished merge-index | |
git write-tree \ | |
| xargs -i@ git commit-tree @ -p $DESTINATION -p $SOURCE -m "Merge $SOURCE into $DESTINATION" \ | |
| xargs git update-ref -m"Merge $SOURCE into $DESTINATION" refs/heads/$DESTINATION ; | |
exit 0 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment