git open
opens the Git repository in the web browser.
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
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
Install with brew
.
$ brew install arbourd/tap/git-open
Install with go install
.
$ go install github.com/arbourd/git-open@latest