git-browse
Open repository in web browser
TLDR
Open the current repository in the browser, using its current commit/branch
$ git browse
Open a specific remote's repository$ git browse [upstream]
Open a specific file on a remote$ git browse [upstream] [path/to/file]
Jump to a specific line in a file$ git browse [upstream] [path/to/file] [42]
Jump to a range of lines in a file$ git browse [upstream] [path/to/file] [1] [42]
SYNOPSIS
git browse [remote-name] [filename] [line1] [line2]
DESCRIPTION
git browse is a git-extras command that detects the current repository's remote URL and opens it in the default web browser. It recognizes GitHub, GitLab, and Bitbucket remotes and builds the correct web URL format for each, including deep links to a specific file and line (or line range) at the current commit or branch.SSH remotes (git@host:user/repo.git) are converted to HTTPS automatically. Without a filename, it just opens the repository's landing page for the current commit/branch.
PARAMETERS
REMOTE-NAME
Remote to browse; defaults to the current branch's tracked remote, or origin.FILENAME
Path (relative to repo root) of a file to open on the remote.LINE1
Starting line number to highlight (requires filename).LINE2
Ending line number, to highlight a range (requires line1).
INSTALL
sudo apt install git
sudo dnf install git
sudo pacman -S git
sudo apk add git
sudo zypper install git
brew install git
nix profile install nixpkgs#git
CAVEATS
Only recognizes GitHub, GitLab, and Bitbucket remote URL formats. Requires a browser opener (open, xdg-open, or start) available on the system.
SEE ALSO
gh-browse(1), git-extras(1)