Skip to content

Instantly share code, notes, and snippets.

@switowski
Created January 21, 2019 17:03
Show Gist options
  • Save switowski/8fdb9a1afef4e02e1ae7198088ab197d to your computer and use it in GitHub Desktop.
Save switowski/8fdb9a1afef4e02e1ae7198088ab197d to your computer and use it in GitHub Desktop.
mpr = "!f() { \
declare currentBranch=\"$(git symbolic-ref --short HEAD)\"; \
declare branch=\"${2:-$currentBranch}\"; \
if [ $(printf \"%s\" \"$1\" | grep '^[0-9]\\+$' > /dev/null; printf $?) -eq 0 ]; then \
git fetch origin refs/pull/$1/head:pr/$1 && \
git checkout -B $branch && \
git rebase $branch pr/$1 && \
git checkout -B $branch && \
git merge --ff-only pr/$1 && \
git branch -D pr/$1; \
fi \
}; f"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment