Last active
October 4, 2017 13:15
-
-
Save orgads/75ca0c4396baad7bcf6b94c6e739aa08 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/bin/sh | |
| merge() { | |
| git merge --no-edit --no-verify origin/$1 | |
| git mergetool || exit 1 | |
| git commit --no-edit --no-verify | |
| } | |
| #git fetch | |
| read commit p1 p2 <<<$(git rev-list --parents HEAD -n1) | |
| [ -z "$p2" ] && exit 0 | |
| upstream=$(upstream.rb $p1) | |
| merged=$(upstream.rb $p2) | |
| merge $merged | |
| merge $upstream | |
| new_commit=$(git show -s --format=%B $commit | perl -0pe 's/\n*\Z/\n/' | git commit-tree -p origin/$upstream -p origin/$merged $(git write-tree)) | |
| git reset $new_commit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment