LinuxCommandLibrary

hub-browse

Open GitHub repository in a web browser

TLDR

Open the homepage of the current repository in the default web browser

$ hub browse
copy

Open the homepage of a specific repository in the default web browser
$ hub browse [owner]/[repository]
copy

Open the subpage of a specific repository in the default web browser, subpage can be "wiki", "commits", "issues", or other (default: "tree")
$ hub browse [owner]/[repository] [subpage]
copy

SYNOPSIS

hub browse [-b BASE] [-c COMMIT] [-h HOST] [-u URL] [PATH] [-- COMMIT]

PARAMETERS

-b, --base BASE
    Browse specific branch, tag, or base commit

-c, --commit COMMIT
    Browse specific commit (after PATH)

-h, --host HOST
    GitHub host (e.g., github.com, enterprise hostname)

-u, --url URL
    Open exact URL instead of auto-generating

PATH
    Repository subpath (file/dir) to browse

-- COMMIT
    Commit for PATH (positional separator)

DESCRIPTION

hub browse is a command from the hub toolkit, a Git extension for seamless GitHub integration. It automatically opens your default web browser to the GitHub page for the current repository, branch, commit, or file path.

Without arguments, it navigates to the repository's default branch on GitHub (using the 'origin' remote). Specify a PATH to view files or directories, --commit for specific commits, or options like --base for branches/tags. It detects the GitHub host from remotes, supporting GitHub Enterprise via -h.

This tool streamlines workflows by eliminating manual URL construction or browser searches, ideal for developers switching between CLI and web views. It requires a GitHub remote and works in any Git repo directory.

Hub enhances Git commands like clone, pull-request, and browse for GitHub-specific features.

CAVEATS

Requires GitHub 'origin' remote; no active development since GitHub CLI (gh) launch; may fail on non-GitHub remotes without -h.

EXAMPLES

hub browse (opens repo default branch)
hub browse README.md (opens file)
hub browse --commit abc1234 (opens commit)
hub browse -h github.myenterprise.com lib/ (Enterprise path)

DEPENDENCIES

Needs hub installed (>=2.0), Git, and $BROWSER or xdg-open/open.

HISTORY

Created 2011 by GitHub contributors as 'hub' Git wrapper. Major releases through 2018 (v2.14). Maintenance declined post-2020 with gh CLI debut; still widely used.

SEE ALSO

hub(1), gh repo view(1), git remote(1)

Copied to clipboard