mirror of
https://github.com/wahyd4/dotfiles.git
synced 2026-08-09 04:46:12 +10:00
.gitconfig: Add alias to merge GitHub pull request
Ref. https://help.github.com/articles/checking-out-pull-requests-locally Closes #422.
This commit is contained in:
committed by
Mathias Bynens
parent
f89753ed06
commit
ab9c1785d8
+12
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user