GIT-OPEN(1)

πŸ“¦ version 3.1.0, in nixos 26.05, nixpkgs unstable

πŸŽ€ git-open(1) πŸŽ€

Bestie, this is the git-open page from the Git manual, version 3.1.0 β€” and it’s literally here to open your repo’s website in your browser. πŸ’…βœ¨


🌸 NAME 🌸

git-open β€” Open the repository’s website in your browser.


✨ SYNOPSIS ✨

git open [–issue] [–commit] [–suffix some_suffix] [remote-name] [branch-name]

πŸ’– DESCRIPTION πŸ’–

git open opens the repository’s website in your browser. The major well known git hosting services are supported. 🫢


πŸ¦‹ OPTIONS πŸ¦‹

  • -c, --commit β€” Open the current commit. See EXAMPLES for more information. Only tested with GitHub & GitLab.
  • -i, --issue β€” Open the current issue. When the name of the current branch matches the right pattern, it will open the webpage with that issue. See EXAMPLES for more information. This only works on GitHub, GitLab, Visual Studio Team Services and Team Foundation Server at the moment.
  • -s, --suffix some_suffix β€” Append the given suffix to the url.
  • -p, --print β€” Just print the URL. Do not open it in browser.
  • -h β€” Show a short help text.

🌈 EXAMPLES 🌈

Okay so, examples time β€” this is where it all clicks. ✨

git open

It opens https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/

git open someremote

It opens https://github.com/PROVIDED_REMOTE_USER/CURRENT_REPO/

git open someremote somebranch

It opens https://github.com/PROVIDED_REMOTE_USER/CURRENT_REPO/tree/PROVIDED_BRANCH

git open --issue

If branches use naming convention of issues/#123, it opens https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/issues/123

git open --suffix pulls

It opens the URL https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/pulls

git open --print

It prints the URL https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/

git open --commit

Supposing that the current sha is 2ddc8d4548d0cee3d714dcf0068dbec5b168a9b2, it opens https://github.com/TRACKED_REMOTE_USER/CURRENT_REPO/commit/2ddc8d4548d0cee3d714dcf0068dbec5b168a9b2


πŸ‘‘ SUPPORTED GIT HOSTING SERVICES πŸ‘‘

git-open can automatically guess the corresponding repository page for remotes on the following git hosting services:

  • github.com
  • gist.github.com
  • gitlab.com
  • GitLab CE/EE (self hosted GitLab, see CONFIGURATION)
  • bitbucket.org
  • Atlassian Bitbucket Server (formerly Atlassian Stash)
  • Visual Studio Team Services
  • Team Foundation Server (on-premises)

πŸŽ€ CONFIGURATION πŸŽ€

To configure git-open you may need to set some git config options. You can use --global to set across all repos, instead of just the current repo.

git config [--global] option value

🌿 Configuring which remote to open 🌿

By default, git open opens the remote named origin. However, if your current branch is remotely-tracking a different remote, that tracked remote will be used.

In some instances, you may want to override this behavior. When you fork a project and add a remote named upstream you often want that upstream to be opened rather than your fork. To accomplish this, you can set the open.default.remote within your project:

git config open.default.remote upstream

This is equivalent to always typing git open upstream.

πŸ“ Gitea options πŸ“

To configure Gitea support you need to set the following option.

open.[gitdomain].forge The git forge present at the git domain. This only needs to be set for Gitea because it uses another branch URL format.

✨ Example ✨

git config [--global] "open.https://gitea.internal.biz.forge" "gitea"

🧚 GitLab options 🧚

To configure GitLab support (or other unique hosting situations) you may need to set some options.

open.[gitdomain].domain The (web) domain to open based on the provided git repo domain.

open.[gitdomain].protocol The (web) protocol to open based on the provided git repo domain. Defaults to https.

git config [--global] open.[gitdomain].domain [value]
git config [--global] open.[gitdomain].protocol [value]

πŸ’… Example πŸ’…

git config [--global] "open.https://git.internal.biz.domain" "repo.intranet/subpath"
git config [--global] "open.https://git.internal.biz.protocol" "http"

πŸ”₯ DEBUGGING πŸ”₯

You can run git-open in echo mode, which doesn’t open your browser, but just prints the URL to stdout:

env BROWSER='echo' ./git-open

πŸ’œ AUTHORS πŸ’œ

Jason McCreary did the initial hard work. Paul Irish based his project on his work. Since then many contributors have submitted great PRs.


⭐ SEE ALSO ⭐


πŸ’– That’s the whole manual, bestie β€” Source/version: Git manual, git-open 3.1.0 Β· Date: not printed in this copy. 🫢

πŸ“¦ where this page comes from