app git-brws

Command line tool to open a repository, file, commit, diff, tag, pull request, issue or project’s website in your web browser from command line

21 releases (10 breaking)

✓ Uses Rust 2018 edition

new 0.11.2 May 19, 2019
0.10.1 Feb 12, 2019
0.9.0 Dec 31, 2018
0.6.1 Jan 30, 2018
0.4.1 Dec 28, 2016

#8 in Command line utilities

Download history 2/week @ 2019-02-01 28/week @ 2019-02-08 7/week @ 2019-02-22 39/week @ 2019-03-01 3/week @ 2019-03-08 23/week @ 2019-03-15 236/week @ 2019-03-22 1/week @ 2019-03-29 20/week @ 2019-04-05 5/week @ 2019-04-12 2/week @ 2019-04-19 26/week @ 2019-04-26 44/week @ 2019-05-03 23/week @ 2019-05-10

144 downloads per month

MIT license


git brws Linux and macOS CI Windows CI

git brws is a command line tool to open a repository, file, commit, diff, tag, blame, pull request, issue or project's website in your web browser from command line. 'brws' is an abbreviation of 'browse'.



git brws is available on Linux, macOS and Windows.

With Homebrew

$ brew tap "rhysd/git-brws" ""
$ brew install git-brws

It installs git-brws to /usr/local/bin and git-brws.1 to /usr/local/share/man/man1. This is recommended way for installation on macOS since updating to the new version is easy.

With cargo

$ cargo install git-brws

As a single executable binary

Pre-built binary executables are available at release page for macOS (64bit), Linux (64bit, 32bit) and Windows (64bit, 32bit). Download and unarchive the binary then put the executable in $PATH.

Manpage for man command is available. Please find git-brws.1 in the unarchived directory or download it from here and copy it to the man directory in your system (e.g. /usr/local/share/man/man1/).

Note: git brws --help only works when it is installed.


Usage: git brws [Options] {Args}

    -r, --repo REPO     Shorthand format (repo, user/repo, host/user/repo) or
                        Git URL you want to see. When only repo name is
                        specified, most popular repository will be searched
                        from GitHub
    -b, --branch BRANCH Branch name to browse. Default value is current branch
    -d, --dir PATH      Directory path to the repository. Default value is
                        current working directory
    -R, --remote REMOTE Remote name (e.g. origin). Default value is a remote
                        the current branch is tracking. If current branch
                        tracks no branch, it falls back to 'origin'
    -u, --url           Output URL to stdout instead of opening in browser
    -p, --pr            Open pull request page instead of repository page. If
                        not existing, open 'Create Pull Request' page
    -w, --website       Open website page instead of repository page (homepage
                        URL for GitHub, GitLab pages, Bitbucket Cloud)
    -B, --blame         Open blame page instead of repository page. File path
                        to blame must be passed also.
    -h, --help          Print this help
    -v, --version       Show version

Open a repository page

  • Repository at current directory
$ git brws
  • develop branch
$ git brws -b develop
  • origin remote of develop branch
$ git brws -r origin -b develop
  • @rhysd's 'Shiba' repository
$ git brws -r rhysd/Shiba
  • Most popular react repository on GitHub
$ git brws -r react

It will open

Note: When only repository name is specified for -r option, git-brws searches GitHub with query {repo} in:name and opens the best-matched repository page.

  • Specify directory of repository
$ git brws -d ~/.go/src/

Open a file page

  • File of current branch of current remote
$ git brws ./some/file.txt
  • Line of the file
$ git brws ./some/file.txt#L123

Note: The L can be omit.

  • Range from line to line of the file
$ git brws ./some/file.txt#L123-L126

Note: The L can be omit.

Open a commit page

  • HEAD page of current repository
$ git brws HEAD

Open a tag page

  • 0.10.0 tag page of current repository
$ git brws 0.10.0

Open a diff page between commits

  • Diff between HEAD and HEAD~3
$ git brws HEAD~3..HEAD
  • Diff between 113079b and 60024ab
$ git brws 60024ab..113079b

Open a diff page from specific commit and its merge base

In addition to .., diff with ... is supported.

  • Diff between branchB and the merge base commit from branchB into branchA
$ git brws branchA...branchB

If you don't know the difference between .. and ..., please read git diff --help.

Note: Only GitHub and GitHub Enterprise support .... For GitLab, only ... is available.

Open a pull request page

  • Pull request page of current branch of current repository
$ git brws --pr
  • Pull request page of specific branch of specific repository
# Specify my forked repository
$ git brws --pr --repo rhysd/rust.vim -b async-contextual-keyword

# Or specify original repository
$ git brws --pr --repo rust-lang/rust.vim -b async-contextual-keyword

Note: Currently only GitHub and GitHub Enterprise are supported.

Note: If you have created multiple pull requests at the same repository with the same branch name, the command may not open a pull request page you want.

Note: When a pull request page for current branch is not existing yet, it opens 'Create Pull Request' page instead.

Open a website for the repository

# Website for current repository
$ git brws --website

With --repo option, arbitrary repository's website can be opened.

# Opens
$ git brws --website --repo react

It opens a website for the repository.

  • For GitHub, URL for 'homepage' configuration of the repository if it's set. Otherwise https://{user}{repo}
  • For GitHub Enterprise, https://pages.{host}/{user}/{repo} or https://{host}/pages/{user}/{repo} depending on your GitHub Enterprise configuration of subdomain isolation
  • For GitLab, GitLab Pages
  • For Bitbucket, Bitbucket Cloud

Open an issue page

  • Issue #8
$ git brws '#8'

Note: # is usually used for a line comment in major shells. Please quote the argument

Open a blame page

  • Specific file
$ git brws --blame some/file.txt
  • Specific line at file
$ git brws --blame some/file.txt#L5
  • Specific range at file
$ git brws --blame some/file.txt#L5-L9

Cooperate with other tools

With -u option, git brws outputs URL to stdout.

For example, in Vim, you can write your repository URL to your text instantly.

:r!git brws -u

And below can open editing file in your browser.

:!git brws %


Some environment variables are available to customize behavior of git-brws.

Variable Description
$GIT_BRWS_GIT_COMMAND Git command to use. If not specified, "git" will be used.
$GIT_BRWS_GHE_URL_HOST When you use your own GitHub Enterprise repository, you can specify its host to this variable. By default, git brws detects ^github\. as GHE host. If your GHE repository host does not match it, please specify this variable. If your repository is, should be set.
$GIT_BRWS_GHE_SSH_PORT When you set a number to it, the number will be used for the ssh port for GitHub Enterprise URLs.
$GIT_BRWS_GITLAB_SSH_PORT When you set a number to it, the number will be used for the ssh port for self-hosted GitLab URLs. This is useful when your environment hosts GitLab to non-trivial ssh port URL.
$GIT_BRWS_GITHUB_TOKEN This variable is used for --pr (or -p) only. API access token for They are optional, but useful for avoiding API rate limit and accessing to private repositories. Please generate a token from
$GIT_BRWS_GHE_TOKEN This variable is used for --pr (or -p) only. API access token for GitHub Enterprise instance. It is sometimes mandatory (depending on your GHE instance configuration). Please generate a token from https://{YOUR GHE HOST}/settings/tokens/new.
$GIT_BRWS_BROWSE_COMMAND Command to open URL. If this value is specified, the command is executed with URL as first argument to browse the URL.
$https_proxy This variable is used for --pr (or -p) only. A HTTPS Proxy server URL if you use a web proxy.

Related Projects


Distributed under the MIT license.


Please see the project page.


Repository for git-brws is hosted at GitHub.

To watch file changes and run linter/tests automatically:

cargo install cargo-watch
cargo watch -x clippy -x test

Some tests require GitHub API access token. To run full tests:

export GITHUB_TOKEN=xxxxxxxxxxx
cargo test

cargo test and cargo clippy are automatically run on pushing to remote by cargo-husky. But some tests fail when the remote tracking branch does not exist. When you create a new branch, please use --no-verify. Please do not use --no-verify otherwise.

git checkout -b new-branch
git push -u origin new-branch --no-verify

To update manpage file git-brws.1 and docs/index.html, please edit git-brws.1.ronn and generate git-brws.1 automatically with docs/ script. ronn is necessary as a dependency.

gem install ronn

To update Homebrew formula file, please use HomebrewFormula/

For example, when updating to 0.9.2:

./HomebrewFormula/ 0.9.2

To update changelog, please run changelog-from-release after describing release note at GitHub repository. It regenerates from releases on GitHub.

go get


~383K SLoC