diff options
author | Cătălin Mariș <alrraa@gmail.com> | 2014-09-19 18:18:22 +0300 |
---|---|---|
committer | Mathias Bynens <mathias@qiwi.be> | 2014-09-20 08:48:51 +0200 |
commit | ab9c1785d8c95acdfbf47f2f0f3da72ca6026ca3 (patch) | |
tree | 71c4cf8056c48a6c1ab2883c4665feffa7598fe9 | |
parent | f89753ed06f3e8d291070693115f5a51ec36e0bc (diff) | |
download | dotfiles-ab9c1785d8c95acdfbf47f2f0f3da72ca6026ca3.tar.gz dotfiles-ab9c1785d8c95acdfbf47f2f0f3da72ca6026ca3.tar.bz2 dotfiles-ab9c1785d8c95acdfbf47f2f0f3da72ca6026ca3.zip |
.gitconfig: Add alias to merge GitHub pull request
Ref. https://help.github.com/articles/checking-out-pull-requests-locally
Closes #422.
-rw-r--r-- | .gitconfig | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -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 |