Git open anything One more (implicit!) alias to improve your git workflow
We’ve already discussed git aliases in a separate post. But there is one more helpful thing, which is an individual tool, thus we didn’t discuss it altogether with other aliases. Git open is a shortcut CLI command that allows you to open a repo website (GitHub, GitLab, or Bitbucket) in your browser. The typical use case is when you’ve commited and pushed something and then want to quickly open GitHub to create a PR.
The command is registered as an implicit alias. That’s it — any
executable on your path that is git-
prefixed is treated as a git
subcommand, so you can call it without a dash, for example, git open
will simply call git-open
bash script that exists in your $PATH
.
This said, you just need to grab the script and put it in a folder which
is in your path:
curl https://raw.githubusercontent.com/paulirish/git-open/master/git-open > /usr/local/bin/git-open
chmod +x /usr/local/bin/git-open
Voila! You can not jump in any repo published on GitHub, GitLab, or
Bitbucket and type git open
to open the browser! Neat. Of course, if
you are in a forked repository and want to open upstream repo, you can
do that with git open upstream
. To open a specific branch, please use
git open origin branch
.
The project repo has more documentation on how to install the script with your favorite package manager, how to use self-hosted solutions, etc.
Happy hacking!