aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCătălin Mariș <alrraa@gmail.com>2014-09-19 18:18:22 +0300
committerMathias Bynens <mathias@qiwi.be>2014-09-20 08:48:51 +0200
commitab9c1785d8c95acdfbf47f2f0f3da72ca6026ca3 (patch)
tree71c4cf8056c48a6c1ab2883c4665feffa7598fe9
parentf89753ed06f3e8d291070693115f5a51ec36e0bc (diff)
downloaddotfiles-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--.gitconfig12
1 files changed, 12 insertions, 0 deletions
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