Discover, install, and configure shell plugins with Fig Plugin Store →
📂

Git Open

Type git open to open the repo website (GitHub, GitLab, Bitbucket) in your browser

Paul Irish
Jason McCreary
|
2.9k stars
221 forks

Type git open to open the repo website (GitHub, GitLab, Bitbucket) in your browser.

Demo of git open in action

Usage

# Open the page for this branch on the repo website
git open [remote-name] [branch-name]

# Open the current commit in the repo website
git open --commit
git open -c

# If this branch is named like issue/#123, this will open the corresponding
# issue in the repo website
git open --issue
git open -i

# Only print the url at the terminal, but don't open it
git open --print
git open -p

(git open works with these hosted repo providers, git open --issue currently only works with GitHub, Visual Studio Team Services and Team Foundation Server)

Examples

# opens https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/tree/CURRENT_BRANCH
$ git open

# opens https://github.com/PROVIDED_REMOTE_USER/CURRENT_REPO/tree/CURRENT_BRANCH
$ git open someremote

# opens https://github.com/PROVIDED_REMOTE_USER/CURRENT_REPO/tree/PROVIDED_BRANCH
$ git open someremote somebranch

# If branches use naming convention of issues/#123,
# opens https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/issues/123
$ git open --issue

# prints https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/tree/CURRENT_BRANCH
$ git open --print

# opens https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/pulls
$ git open --suffix pulls

Supported remote repositories

git-open can automatically guess the corresponding repository page for remotes (default looks for origin) on the following hosts:

  • github.com
  • gist.github.com
  • gitlab.com
  • GitLab custom hosted (see below)
  • bitbucket.org
  • Atlassian Bitbucket Server (formerly Atlassian Stash)
  • Visual Studio Team Services
  • Team Foundation Server (on-premises)
  • AWS Code Commit

Configuration

See the man page for more information on how to configure git-open.

Alternative projects

See hub for complete GitHub opening support. It's the official GitHub project and provides hub browse.

Homebrew has an alternate git-open that only works with GitHub but can open user profile pages, too.

@gerep has an alternate git-open that works with a few providers. Of note, it opens the default view for BitBucket instead of the source view.

And, of course, jasonmccreary's original gh from which this plugin was forked.

Thanks

jasonmccreary did the initial hard work. Since then, many contributors have submitted great PRs.

Related projects