git: Add pr alias which fetches a specific github pull request

Used like `g pr 1234` to create local pr/1234 branch.
This commit is contained in:
Marty Oehme 2025-02-10 12:08:29 +01:00
parent 43aefd2369
commit 98c54443e9
Signed by: Marty
GPG key ID: EDBF2ED917B2EF6A

View file

@ -32,10 +32,12 @@
# check out a github PR directly on the commandline, creates pr/4 or pr/<number> branch locally
pr = "!f() { git fetch -fu ${2:-$(git remote |grep ^github || echo origin)} refs/pull/$1/head:pr/$1 }; f"
# remove all pr/<number> local branches
pr-clean = "!git for-each-ref refs/heads/pr/* --format='%(refname)' | while read ref ; do branch=${ref#refs/heads/} ; git branch -D $branch ; done"
pr-clean = "!git for-each-ref refs/heads/pr/* --format = '%(refname)' | while read ref ; do branch = ${ref#refs/heads/} ; git branch -D $branch ; done"
[commit]
gpgsign = true # sign commits as me
verbose = true # Always show diff when preparing commit message
[tag]
gpgsign = true
[fetch]
prune = true # remove references to non-existent remote branches
[pull]