From 87151f6cb13a898f5ff6c218f25408a36b2925d0 Mon Sep 17 00:00:00 2001 From: Nick Nisi Date: Thu, 25 Jun 2015 19:49:45 -0400 Subject: [PATCH] add git alias for checkout out PRs locally --- git/gitconfig.symlink | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/git/gitconfig.symlink b/git/gitconfig.symlink index 47058a8..498762c 100644 --- a/git/gitconfig.symlink +++ b/git/gitconfig.symlink @@ -78,6 +78,10 @@ # Kaleidoscope commands dkal = difftool -y -t Kaleidoscope remotes = remote -v + + # check out a local copy of a PR. https://gist.github.com/gnarf/5406589 + pr = "!f() { git fetch -fu ${2:-origin} refs/pull/$1/head:pr/$1 && git checkout pr/$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" [color] diff = auto status = auto