Skip to content

arbourd/git-open

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-open

git open opens the Git repository in the web browser.

Usage

Open the root of a repository.

$ git open

Open a specific file or folder of a repository.

$ git open LICENSE

Open a specific commit of a repository.

$ git open 7605d91

Open a different repository than cwd.

$ git -C ~/src/my-repo open

Providers

By default, three providers github.com, gitlab.com and bitbucket.org are supported.

To add custom Git providers and their URLs, set their values within the global git config.

[open "https://git.mydomain.dev"]
    commitprefix = commit
    pathprefix = tree

This can also be set using the git CLI.

$ git config --global open.https://git.mydomain.dev.commitprefix commit
$ git config --global open.https://git.mydomain.dev.pathprefix tree

commitprefix and pathprefix are used to template the URI for your provider.

fmt.Println(host + "/" + repository + "/" + commitprefix )
// https://git.mydomain.dev/<repository>/commit

fmt.Println(host + "/" + repository + "/" + pathprefix )
// https://git.mydomain.dev/<repository>/tree

Installation

Install with brew.

$ brew install arbourd/tap/git-open

Install with go install.

$ go install github.com/arbourd/git-open@latest