Skip to content

Instantly share code, notes, and snippets.

@jhannah
Created November 29, 2017 18:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jhannah/5a52b081c088fb796ec5fab1cde5888a to your computer and use it in GitHub Desktop.
Save jhannah/5a52b081c088fb796ec5fab1cde5888a to your computer and use it in GitHub Desktop.
git pr git pr-clean
From: https://gist.github.com/gnarf/5406589
✗ git pr 2528
* [new ref] refs/pull/2528/head -> pr/2528
Switched to branch 'pr/2528'
✗ git pr-clean 2528
git for-each-ref refs/heads/pr/* --format='%(refname)' | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done: -c: line 0: syntax error near unexpected token `"$@"'
git for-each-ref refs/heads/pr/* --format='%(refname)' | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done: -c: line 0: `git for-each-ref refs/heads/pr/* --format='%(refname)' | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done "$@"'
Huh. That's weird. If I run the command does it work?
✗ git for-each-ref refs/heads/pr/* --format='%(refname)' for-each-ref refs/heads/pr/* --format='%(refname)' | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done
Deleted branch pr/2528 (was fcb88bc).
uhh... ok, so the command works if I run it, but somehow not as a git alias?
@jhannah
Copy link
Author

jhannah commented Nov 29, 2017

@nicknisi is a genius. He pointed out that pr-clean doesn't take an argument. Leave it off and it works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment