From ab9c1785d8c95acdfbf47f2f0f3da72ca6026ca3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C4=83t=C4=83lin=20Mari=C8=99?= Date: Fri, 19 Sep 2014 18:18:22 +0300 Subject: .gitconfig: Add alias to merge GitHub pull request Ref. https://help.github.com/articles/checking-out-pull-requests-locally Closes #422. --- .gitconfig | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.gitconfig b/.gitconfig index 3238150..bd24fd2 100644 --- a/.gitconfig +++ b/.gitconfig @@ -57,6 +57,18 @@ # List contributors with number of commits contributors = shortlog --summary --numbered + # Merge GitHub pull request on top of the `master` branch + mpr = "!f() { \ + if [ $(printf \"%s\" \"$1\" | grep '^[0-9]\\+$' > /dev/null; printf $?) -eq 0 ]; then \ + git fetch origin refs/pull/$1/head:pr/$1 && \ + git rebase master pr/$1 && \ + git checkout master && \ + git merge pr/$1 && \ + git branch -D pr/$1 && \ + git commit --amend -m \"$(git log -1 --pretty=%B)\n\nCloses #$1.\"; \ + fi \ + }; f" + [apply] # Detect whitespace errors when applying a patch -- cgit v1.2.3