Created
November 13, 2015 21:24
-
-
Save ScottG489/5a7d7eac431159521845 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
backouter () { | |
if [ $# -ne 1 ] | |
then | |
echo Backout a merge by closing branch of undesired merge then updating to parent of undesired merge and continuing branch from there. | |
echo usage: backouter BAD_MERGE_PARENT | |
return | |
fi | |
hg pull -u && _REV_PARENT=$1 | |
_BRANCH=$(hg log -r $_REV_PARENT --template '{branch}') | |
_TEMP_FILE=tempfile | |
hg update $_BRANCH && hg commit --close-branch -m "Close head of undesired merge." && hg update $_REV_PARENT && touch $_TEMP_FILE | |
hg add $_TEMP_FILE | |
hg commit -m "Continue branch from parent of bad merge ($_REV_PARENT)." | |
hg rm $_TEMP_FILE | |
hg commit -m "Remove temp file created for merge 'backout'." | |
echo | |
echo 'WILL NEED TO PUSH WITH --force' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment