Last active
August 29, 2015 14:10
-
-
Save Fedik/4be893cf5c1265081031 to your computer and use it in GitHub Desktop.
Git Aliase - test pull request
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
# test pull request for remote repository on github | |
# use: | |
# git test-pull REMOTE_NAME PULL_NUMBER | |
test-pull = "!f() { last_commit=$(git log -n 1 --pretty=format:\"%h\") && git fetch $1 pull/$2/head:pull$2 && git merge pull$2 -m \"Merge pull $2\" && echo \"Use for revert: git reset $last_commit && git reset --hard && git branch -D pull$2\"; }; f" | |
# revert, not work in some cases, be aware :smile: | |
# use | |
# git test-revert PULL_NUMBER | |
test-revert = "!f() { commit=$(git log --grep=\"Merge pull $1\" --pretty=format:\"%h\") && previous_commit=$(git log --reverse $commit -n 1 --skip=1 --pretty=format:\"%h\") && git reset $previous_commit && git reset --hard && git branch -D pull$1; }; f" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment