gitow 1.0.0

Open Git remotes and repository pages in your browser from the CLI
Documentation
<p align="center">
  <img src="assets/icon.svg" height="128" alt="gitow icon" />
</p>

<p align="center">
  <a href="https://github.com/WhoSowSee/gitow/graphs/contributors"><img src="https://img.shields.io/github/contributors/WhoSowSee/gitow?style=for-the-badge&color=CBA6F7&labelColor=302D41&logo=data:image/svg%2Bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI+PHBhdGggZmlsbD0iI2NkZDZmNCIgZD0iTTkgMTFhNCA0IDAgMSAwIDAtOCA0IDQgMCAwIDAgMCA4Wm0wIDJjLTMuOSAwLTcgMi03IDQuNVYyMGgxNHYtMi41QzE2IDE1IDEyLjkgMTMgOSAxM1ptOC41LTEuNWEzLjI1IDMuMjUgMCAxIDAgMC02LjUgMy4yNSAzLjI1IDAgMCAwIDAgNi41Wm0wIDEuOGMtLjkgMC0xLjc1LjE1LTIuNS40MiAxLjcgMS4wNSAyLjcgMi40NSAyLjcgMy45OFYyMEgyMnYtMi4zYzAtMi40LTItNC40LTQuNS00LjRaIi8+PC9zdmc+" alt="CONTRIBUTORS"></a>
  <a href="https://github.com/WhoSowSee/gitow/forks"><img src="https://img.shields.io/github/forks/WhoSowSee/gitow?style=for-the-badge&color=89B4FA&labelColor=302D41&logo=data:image/svg%2Bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI%2BPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMTIgMTIpIHNjYWxlKDEuMDgpIHRyYW5zbGF0ZSgtMTIgLTEyKSI%2BPHBhdGggZmlsbD0iI2NkZDZmNCIgZD0iTTYgM2EzIDMgMCAxIDAgMCA2IDMgMyAwIDAgMCAwLTZabTEyIDBhMyAzIDAgMSAwIDAgNiAzIDMgMCAwIDAgMC02Wk0xMiAxNWEzIDMgMCAxIDAgMCA2IDMgMyAwIDAgMCAwLTZaIi8%2BPHBhdGggZmlsbD0iI2NkZDZmNCIgZD0iTTUgOGgydjIuNGMwIC4zMy4yNy42LjYuNmg4LjhjLjMzIDAgLjYtLjI3LjYtLjZWOGgydjIuNGEyLjYgMi42IDAgMCAxLTIuNiAyLjZIMTN2MmgtMnYtMkg3LjZBMi42IDIuNiAwIDAgMSA1IDEwLjRWOFoiLz48L2c%2BPC9zdmc%2B" alt="FORKS"></a>
  <a href="https://github.com/WhoSowSee/gitow/stargazers"><img src="https://img.shields.io/github/stars/WhoSowSee/gitow?style=for-the-badge&color=F9E2AF&labelColor=302D41&logo=data:image/svg%2Bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCI%2BPGcgdHJhbnNmb3JtPSJ0cmFuc2xhdGUoMCAtMS42KSI%2BPHBhdGggZmlsbD0iI2NkZDZmNCIgZD0iTTEyIDIuNSAxNC45IDguNGw2LjUgMWEuOC44IDAgMCAxIC40NSAxLjM2bC00LjcgNC41OCAxLjEgNi40NWEuOC44IDAgMCAxLTEuMTYuODRMMTIgMTkuOTUgNi4yIDIyLjYzYS44LjggMCAwIDEtMS4xNi0uODRsMS4xLTYuNDUtNC43LTQuNThBLjguOCAwIDAgMSAxLjkgOS40bDYuNS0xTDEyIDIuNVoiLz48L2c%2BPC9zdmc%2B" alt="STARS"></a>
</p>

<p align="center">
  <a href="https://crates.io/crates/gitow"><img src="https://img.shields.io/crates/v/gitow?style=for-the-badge&color=FAB387&logo=data:image/svg%2Bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiI%2BCjxwYXRoIGZpbGw9IiNjZGQ2ZjQiIGQ9Ik0xLjUgNi45ODRWMTFsNi41MDMgMy41TDE0LjUgMTFWM0wxMSAxLjVsLTYuNSAzdjF6Ii8%2BCjxnIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzMwMkQ0MSIgc3Ryb2tlLXdpZHRoPSIuOSIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIj4KPHBhdGggZD0iTTEuNSA3TDggMTAuNUwxNC41IDdtLTEwLTIuNWwzLjUwMyAyTDE0LjQ5OCAzTTQuNSA1LjV2N20zLjUtNlYxNCIvPgo8cGF0aCBkPSJNOC4wMDMgM0wxMS41IDQuNXY4Ii8%2BCjwvZz4KPC9zdmc%2B&labelColor=302D41" alt="CRATES.IO"></a>
  <a href="https://crates.io/crates/gitow"><img src="https://img.shields.io/crates/d/gitow?style=for-the-badge&color=A6E3A1&logo=data:image/svg%2Bxml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiI%2BCjxwYXRoIGZpbGw9IiNjZGQ2ZjQiIGQ9Ik0xLjUgNi45ODRWMTFsNi41MDMgMy41TDE0LjUgMTFWM0wxMSAxLjVsLTYuNSAzdjF6Ii8%2BCjxnIGZpbGw9Im5vbmUiIHN0cm9rZT0iIzMwMkQ0MSIgc3Ryb2tlLXdpZHRoPSIuOSIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIj4KPHBhdGggZD0iTTEuNSA3TDggMTAuNUwxNC41IDdtLTEwLTIuNWwzLjUwMyAyTDE0LjQ5OCAzTTQuNSA1LjV2N20zLjUtNlYxNCIvPgo8cGF0aCBkPSJNOC4wMDMgM0wxMS41IDQuNXY4Ii8%2BCjwvZz4KPC9zdmc%2B&labelColor=302D41" alt="DOWNLOADS"></a>
</p>

<h2 align="center">Open Git repository pages from the command line</h2>

<p align="center">
  <img width="800px" alt="preview" src="https://github.com/user-attachments/assets/a75fd3d4-a8f4-4c1b-a853-887ad8d84488"/>
</p>

> [!TIP]
> **Русская версия:** [README-RU.md](README-RU.md)

> [!NOTE]
> **gitow - git open web.** A Rust CLI focused on opening repository web pages from the current working tree. It offers:
>
> - **Repository navigation** - Open repository roots, branches, commits, issues, pull requests, commit history, releases, tracked files, and custom URL suffixes.
> - **Remote resolution** - Resolve Git remote names, literal remote URLs, `insteadOf` rewrites, and SSH config aliases.
> - **Branch-aware links** - Pick the upstream branch, current branch, exact tag, or current commit SHA depending on repository state.
> - **Multi-remote workflow** - Open every configured remote with `--all-remotes`, keeping `origin` first.
> - **Script-friendly output** - Print generated URLs with `--print` or `BROWSER=echo` without launching a browser.
> - **Short command surface** - Use one compact `gitow` binary for every navigation target.

> [!IMPORTANT]
>
> ## Required dependencies:
>
> - Git
> - Rust 1.95 or newer
> - Platform browser launcher or a `BROWSER` command

## Installation

### Install from crates.io

```bash
cargo install gitow
```

This installs the latest published release from crates.io into your Cargo bin directory.

### Install from source

```bash
git clone https://github.com/WhoSowSee/gitow.git
cd gitow
cargo install --path .
```

The command above builds `gitow` and places the binary into the Cargo bin directory, usually `~/.cargo/bin`.

### Run locally without installing

```bash
cargo build --release
./target/release/gitow --print
```

Run the binary through Cargo with:

```bash
cargo run --bin gitow -- --print
```

## Usage

```text
gitow [OPTIONS] [REMOTE_OR_URL] [BRANCH]
```

Examples:

```bash
gitow
gitow upstream
gitow upstream feature/my-branch
gitow git@github.com:owner/repo.git
gitow https://gitlab.example.com/group/project.git main
gitow --print
```

### Navigation targets

- `-c, --commit` - opens the current commit in the forge UI.
- `-i, --issue` - opens the issue inferred from the current branch name.
- `-m, --pull-requests` - opens the pull requests or merge requests page.
- `-C, --commits` - opens the commits page for the selected branch or ref.
- `-r, --releases` - opens the releases page where the forge supports it.
- `-a, --all-remotes` - opens every configured remote.
- `-f, --file <PATH>` - opens a repository-relative tracked file.
- `-s, --suffix <SUFFIX>` - appends an arbitrary suffix to the generated URL.
- `-p, --print` - prints the URL instead of launching a browser.
- `-h, --help` - shows the help text.

### Common workflows

```bash
gitow --commit
gitow --issue
gitow --pull-requests
gitow --commits
gitow --releases
gitow --all-remotes
gitow --file src/main.rs
gitow --suffix actions
gitow --print
```

## Remote and branch selection

By default, `gitow` opens:

1. `open.default.remote`, if configured.
2. The current branch's tracked remote, if configured.
3. `origin`.

For the ref, it uses the selected branch's upstream branch when available, otherwise the current branch. In detached `HEAD` state, it falls back to an exact tag and then to the current commit SHA.

## Supported remote repositories

`gitow` detects URL layouts for:

- GitHub
- GitHub Gist
- GitLab.com and self-hosted GitLab instances
- Gitea, Forgejo, Gogs, and Codeberg
- Bitbucket Cloud
- Bitbucket Server / Atlassian Stash
- Azure DevOps / Visual Studio Team Services / Team Foundation Server
- AWS CodeCommit
- generic Git hosting URLs

Some pages are forge-specific. Releases are supported for GitHub, GitLab, and Gitea-compatible forges. AWS CodeCommit does not support the issue shortcut.

## Configuration

`gitow` uses normal Git configuration. Add `--global` to apply an option to all repositories.

### Default remote

Set the remote that should be opened when no remote argument is provided:

```bash
git config open.default.remote upstream
```

### Custom web domain and protocol

If the Git remote host differs from the web UI host, configure URL-matched overrides:

```bash
git config "open.https://git.example.com.domain" "repo.intranet/subpath"
git config "open.https://git.example.com.protocol" "http"
```

For example, a remote like:

```text
ssh://git@git.example.com:7000/team/repo.git
```

can open as:

```text
http://repo.intranet/subpath/team/repo
```

### Gitea, Forgejo, and Gogs

Gitea-compatible forges use a different branch URL layout. Codeberg and domains containing `gitea`, `forgejo`, or `gogs` are detected automatically. For custom domains, configure the forge type explicitly:

```bash
git config "open.https://git.internal.example.forge" "gitea"
```

Accepted values `gitea`, `forgejo`, and `gogs` are normalized to `gitea`.

### SSH config aliases

SCP-style remotes can be resolved through SSH config aliases:

```text
Host work
  HostName git.internal.example
```

```bash
git remote set-url origin work:team/repo.git
gitow --print
# prints https://git.internal.example/team/repo
```

The tool reads the path from the `GITOW_SSH_CONFIG` environment variable first, then falls back to `$HOME/.ssh/config` when it exists.

## Browser selection and debugging

By default, `gitow` uses the platform browser launcher:

- Windows: `cmd /C start`
- macOS: `open`
- Linux: `xdg-open`
- WSL: Windows PowerShell `Start`

Set `BROWSER` to use a specific browser command:

```bash
BROWSER=firefox gitow
```

Use `--print` or `BROWSER=echo` to inspect generated URLs without opening a browser:

```bash
gitow --print
BROWSER=echo gitow
```

## Development

```bash
cargo fmt --check
cargo clippy --all-targets -- -D warnings
cargo test
```

## Star History

<p align="center">
  <a href="https://starchart.cc/WhoSowSee/gitow">
    <picture>
      <source
        media="(prefers-color-scheme: dark)"
        srcset="https://starchart.cc/WhoSowSee/gitow.svg?variant=custom&background=%230d1117&axis=%238b949e&line=%232f81f7"
      />
      <source
        media="(prefers-color-scheme: light)"
        srcset="https://starchart.cc/WhoSowSee/gitow.svg?variant=custom&background=%23ffffff&axis=%2357606a&line=%230969da"
      />
      <img
        alt="Stargazers over time"
        src="https://starchart.cc/WhoSowSee/gitow.svg?variant=custom&background=%23ffffff&axis=%2357606a&line=%230969da"
      />
    </picture>
  </a>
</p>

<p align="center">
  <img src="https://raw.githubusercontent.com/catppuccin/catppuccin/main/assets/footers/gray0_ctp_on_line.svg?sanitize=true" alt="catppuccin" />
</p>

<p align="center">
  <i><code>&copy 2026-present <a href="https://github.com/WhoSowSee">WhoSowSee</a></code></i>
</p>

<p align="center">
  <a href="https://github.com/WhoSowSee/gitow/blob/main/LICENSE"><img src="https://img.shields.io/github/license/WhoSowSee/gitow?style=for-the-badge&color=CBA6F7&logoColor=cdd6f4&labelColor=302D41" alt="LICENSE"></a>
</p>