-
-
Save kernelsmith/7449293 to your computer and use it in GitHub Desktop.
git alias for pr-url to open a browser with a PR to the intended user and branch
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
[user] | |
uname = ks | |
[alias] | |
branch-current = rev-parse --abbrev-ref HEAD | |
# Usage: git pr-url HISNAME HISBRANCH | |
# Example: git pr-url rapid7 master | |
# Example: git pr-url OJ feature/cool_feature_that_also_fixes_bugs | |
pr-url =!"xdg-open https://github.com/$(git config user.uname)/$(basename $(git rev-parse --show-toplevel))/pull/new/$1:$2...$(git branch-current) #" | |
# OSX. Use whatever browser you use | |
#pr-url =!"open -a \"Google Chrome\" https://github.com/$(git config user.uname)/$(basename $(git rev-parse --show-toplevel))/pull/new/$1:$2...$(git branch-current) #" | |
# NOTE: you may be able to use config user.name if that matches your username |
Thanks @kernelsmith, I did see this, made a minor change to use github.user
instead, and it's fantastico. I'm going to be writing a blog post today about all my various and sundry git/github dot files, I just need to remember to also update the documentation on http://r-7.co/MSF-DEV as well.
Slightly santized dotfiles are here: https://github.com/todb/junkdrawer/tree/master/dotfiles/git-repos
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
$ git config remote.origin.url
=> https://github.com/kernelsmith/metasploit-framework.git
This would give us a good starting URL, but you can't rely on the idea that the URL will always be HTTPS, as it could be git, so we'll have to build it, however this does basically give us a good place to get the name of the git repo
However, this works pretty well too, neither are very windows friendly: