-
-
Save chr15m/c3f76f97f0feabab2e293424023ddb86 to your computer and use it in GitHub Desktop.
Open a GitHub pull-request page from the command line
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 python | |
import webbrowser | |
import subprocess | |
def git(*args): | |
return subprocess.check_output(["git"] + list(args)) | |
remote, branch = git("rev-parse", "--abbrev-ref", "--symbolic-full-name", "@{u}").split("/") | |
repo = git("config", "--get", "remote." + remote + ".url").split(":").pop().replace(".git", "").strip("\n") | |
webbrowser.open("https://github.com/%s/tree/%s" % (repo, branch)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment