命令行工具,用于在浏览器中打开仓库、文件、提交、差异、标签、Pull Request、责任、问题或项目的网站,适用于各种仓库托管服务
命令行工具,用于在浏览器中打开仓库、文件、提交、差异、标签、Pull Request、责任、问题或项目的网站,适用于各种仓库托管服务
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'.
Features:
git brws is available on Linux, macOS and Windows.
$ brew tap "rhysd/git-brws" "https://github.com/rhysd/git-brws"
$ brew install git-brwsIt 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.
You can install git-brws via the AUR package:
git clone https://aur.archlinux.org/git-brws.git
cd git-brws
makepkg -siPre-built binary executables are available at release page for following targets:
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. git brws -h is always available.
$ cargo install git-brwsIt requires Rust toolchain to build git-brws from sources.
…$ git brwsdevelop branch$ git brws -b developorigin remote of develop branch$ git brws -r origin -b develop$ git brws -r rhysd/Shibareact repository on GitHub$ git brws -r reactIt will open https://github.com/facebook/react.
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.
$ git brws -d ~/.go/src/github.com/rhysd/dot-github$ git brws ./some/file.txt$ git brws ./some/file.txt#L123Note: The L can be omit.
$ git brws ./some/file.txt#L123-L126Note: The L can be omit.
HEAD page of current repository$ git brws HEAD0.10.0 tag page of current repository$ git brws 0.10.0HEAD and HEAD~3$ git brws HEAD~3..HEAD113079b and 60024ab$ git brws 60024ab..113079bIn addition to .., diff with ... is supported.
branchB and the merge base commit from branchB into branchA$ git brws branchA...branchBIf 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.
$ git brws --pr# 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-keywordNote: 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.
# Website for current repository
$ git brws --websiteWith --repo option, arbitrary repository's website can be opened.
# Opens https://reactjs.org
$ git brws --website --repo reactIt opens a website for the repository.
https://{user}.github.io/{repo}https://pages.{host}/{user}/{repo} or https://{host}/pages/{user}/{repo}
depending on your GitHub Enterprise configuration of subdomain isolation$ git brws '#8'Note: # is usually used for a line comment in major shells. Please quote the argument
$ git brws --blame some/file.txt$ git brws --blame some/file.txt#L5$ git brws --blame some/file.txt#L5-L9With -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 -uAnd 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 https://example-repo.org/user/repo, example-repo.org 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_URL_HOST |
When you use self-hosted GitLab instance, you can specify its host to this variable. By default, git brws detects host matching to ^gitlab\. as GitLab. If your GitLab URL host does not match it, please specify this variable. If your repository is hosted at https://your-code.net/user/repo, your-code.net should be set. |
$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 github.com. They are optional, but useful for avoiding API rate limit and accessing to private repositories. Please generate a token from https://github.com/settings/tokens/new |
$GITHUB_TOKEN |
Ditto. When GIT_BRWS_GITHUB_TOKEN is not set, GITHUB_TOKEN is looked. |
$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. |
$GIT_BRWS_SHORT_COMMIT_HASH |
Setting true will use 7-letters short commit hash like 78fbce6 for URLs. |
$https_proxy |
This variable is used for --pr (or -p) only. An HTTPS Proxy server URL if you use a web proxy. |
Please see the project page.
Please see CONTRIBUTING.md.
Distributed under the MIT license.
暂无开放 Issues,或尚未同步最近议题。