Skip to content

iloveitaly/gh-url

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Generate a GitHub URL for any git ref

gh url takes a branch, tag, or commit ref and outputs the corresponding GitHub URL. It copies the result to your clipboard by default.

Installation

gh extension install iloveitaly/gh-url

For local development:

git clone https://github.com/iloveitaly/gh-url
cd gh-url
gh extension install .

Usage

gh url [ref] [--no-clip] [--open]

ref can be a branch, tag, or commit SHA. Defaults to HEAD.

gh url          # current HEAD
gh url main     # branch
gh url v1.2.3   # tag
gh url abc1234  # commit

Features

  • Outputs the appropriate URL based on ref type:
    • Branch → .../tree/<branch>
    • Tag → .../releases/tag/<tag>
    • Commit → .../commit/<sha>
  • Copies the URL to the clipboard automatically (macOS and Linux)
  • --no-clip to skip clipboard copy
  • --open to open the URL in your browser
  • Handles both SSH and HTTPS remote URLs

Related Projects

  • gh-pr-url — generate a URL for a pull request
  • gh-repo-url — generate a URL for a repository
  • gh-compare — generate a comparison URL between two refs

About

Generate a GitHub URL for any git ref — branch, tag, or commit.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors