git-browse
Open Git repository in a web browser
TLDR
Open the first upstream in the default browser
Open a specific upstream in the default browser
SYNOPSIS
git browse [-r|--remote <remote>]
PARAMETERS
-r, --remote <remote>
Specify the remote to browse. If not specified, 'origin' is used.
--no-guess
Disable guessing the remote to browse when no remote is set.
DESCRIPTION
The git browse
command opens a Git repository in your web browser. It determines the correct URL for your repository based on the remotes configured in your Git configuration and your system's default browser. If multiple remotes exist, it prioritizes 'origin'. You can specify a different remote to browse using the -r
or --remote
option. It supports popular Git hosting platforms like GitHub, GitLab, and Bitbucket. It's particularly useful for quickly navigating to a repository's web interface to view code, issues, pull requests, or other web-based features. If no remote is set, it attempts to autodetect from the current directory. If it can't detect a remote, it presents an error. If your default browser doesn't open the url. It is copied to the clipboard.
CAVEATS
Requires a properly configured Git repository with at least one remote defined. May not work correctly with non-standard Git hosting platforms or custom remote URLs that don't follow standard patterns. Relies on your system's default web browser being correctly configured.
CONFIGURATION
The git browse
command reads the Git configuration to determine the remote URL. This includes the remote.<remote>.url
setting for each remote. It also respects the web.browser
setting for specifying which browser to use. If web.browser
is not set, it uses the system default.
EXAMPLES
git browse
: Opens the 'origin' remote in the default browser.git browse -r upstream
: Opens the 'upstream' remote.
SEE ALSO
git(1), git-remote(1)