gh-browse
Open a GitHub repository in the browser
TLDR
Open the homepage of the current repository in the default web browser
Open the homepage of a specific repository in the default web browser
Open the settings page of the current repository in the default web browser
Open the wiki of the current repository in the default web browser
Open a specific issue or pull request in the web browser
Open a specific branch in the web browser
Open a specific file or directory of the current repository in the web browser
Print the destination URL without open the web browser
SYNOPSIS
gh browse [<url-or-path>] [-b,--branch <branch>] [-c,--commit <commit>] [-R,--repo <repo>]
PARAMETERS
-b, --branch <branch>
Branch or tag to browse instead of default.
-c, --commit <commit>
Commit hash or ref to browse.
-R, --repo [<repo>]
Select repository (defaults to current git remote).
DESCRIPTION
The gh browse command from GitHub CLI quickly launches the web interface for a repository, file, branch, commit, issue, pull request, or release in your default browser.
In a Git repository, running gh browse without arguments opens the repository's main page on GitHub.com using the primary remote (origin). It smartly detects context: file paths open specific files; numeric arguments attempt to open matching issues or PRs; branch names switch views. Specify remote repos with --repo.
Ideal for developers switching between CLI and web UI without typing URLs. Requires GitHub authentication via gh auth login and git remotes configured. On Linux, relies on xdg-open for browser launching.
CAVEATS
Needs gh auth login; fails without GitHub access or git repo context. Uses system browser opener (xdg-open on Linux); may prompt if multiple browsers.
CONTEXT DETECTION
gh browse auto-detects:
• No args: repo overview.
• <file>: file view.
• <#>: issue/PR/release.
• URL: direct open.
EXAMPLES
gh browse
gh browse README.md
gh browse 42
gh browse --repo cli/cli --branch v2.0.0
HISTORY
Part of GitHub CLI since v0.5.0 (Jan 2020). Evolved from hub tool; actively developed by GitHub for cross-platform use.


