Skip to content

Instantly share code, notes, and snippets.

@phako
Created May 18, 2017 07:06
Show Gist options
  • Save phako/5769beecec3c8f73ccfcb00312a41de0 to your computer and use it in GitHub Desktop.
Save phako/5769beecec3c8f73ccfcb00312a41de0 to your computer and use it in GitHub Desktop.
Github PR handling aliases
[alias]
pr-fetch = "!f() { git fetch -fu ${2:-origin} refs/pull/$1/head:pr/$1; }; f"
pr = "!f() { git fetch -fu ${2:-origin} refs/pull/$1/head:pr/$1 && git checkout pr/$1; }; f"
pr-merge = "!f() { git fetch -fu ${2:-origin} refs/pull/$1/head:pr/$1 && git merge pr/$1 --no-ff --edit -m 'Merge pull request #'$1; }; f"
pr-clean = "!git for-each-ref refs/heads/pr/* --format=\"%(refname)\" | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment