Last active
January 21, 2019 08:08
-
-
Save adrienjoly/7e9fcd24727f1872007f39bd393d786c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# inspiration: https://davidwalsh.name/pull-down-pr | |
# The `git pr` alias will checkout the branch associated to a given PR. | |
# Usage: `$ git pr 204` | |
git config --global --add alias.pr '!f() { git fetch -fu ${2:-origin} refs/pull/$1/head:pr/$1 && git checkout pr/$1; }; f' | |
# The `git pr-clean` alias will delete all the `pr/*` branches kept locally. | |
# Usage: `$ git pr-clean` | |
git config --global --add alias.pr-clean '!git checkout master ; 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