Skip to content

This is an extension for the git-cli, that allows you to open any git repository in your browser. Just type 'git open' to open the repo website.

License

Notifications You must be signed in to change notification settings

mogensen/go-git-open

Repository files navigation

go-git-open

Build Status Go Report Card codecov FOSSA Status

This is an extension for the git cli, that allows you to open any git repository in your browser.

Just type git open to open the repo website.

Usage

# Open the page for this branch on the repo website
git open

Installation

Linux

curl -Lo /tmp/git-open.tar.gz https://github.com/mogensen/go-git-open/releases/download/v0.0.1/git-open_Linux_x86_64.tar.gz
tar xzvf /tmp/git-open.tar.gz -C /tmp
chmod +x /tmp/git-open 
sudo mv /tmp/git-open /usr/local/bin

macOS

curl -Lo /tmp/git-open.tar.gz https://github.com/mogensen/go-git-open/releases/download/v0.0.1/git-open_Darwin_x86_64.tar.gz
tar xzvf /tmp/git-open.tar.gz -C /tmp
chmod +x /tmp/git-open 
sudo mv /tmp/git-open /usr/local/bin

Windows

Download the binary from the Latest Release and add it to your path.

Supported remote repositories

go-git-open can create correct browser urls for a range of different git repository providers.

The currently tested ones are:

  • github.com
  • gist.github.com
  • bitbucket.org
  • bitbucket - Selfhosted
  • Azure DevOps
  • gitlab.com

Configuration

# Overwrite the domain from the git remote url with a specific domain
git config open.domain dev.azure.co

Contributing & Development

New upstreams

Adding new upstreams are welcome!

Check list:

  • Add internal/gitupstreams/mygit.go with the implementation of how to create the urls
  • Add internal/gitupstreams/mygit_test.go containing tests for the upstream implementation
  • Add the new upstream in internal/gitupstreams/main.go both in NewGitURLHandlerWithOverwrite() and NewGitURLHandler()
  • Consider adding tests in internal/gitupstreams/main_test.go

Testing

go test ./...
# and
make test-coverage

Related projects

This project is based on the idea from paulirish/git-open

License

Licensed under MIT. http://opensource.org/licenses/MIT

FOSSA Status

About

This is an extension for the git-cli, that allows you to open any git repository in your browser. Just type 'git open' to open the repo website.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published