Generate plain URLs to view commits on the remote hosting platform.
$ARGUMENTS can be:
- Empty — default to HEAD.
- Commit hashes — one or more, separated by spaces or commas.
- Natural language — e.g., "last 5 commits", "today's commits", "commits since yesterday". Interpret the intent and use the appropriate git command to resolve the hashes (e.g.,
git log -5 --format="%H",git log --since="yesterday" --format="%H").
To distinguish: if all non-empty segments look like hex strings (4+ hex chars), treat them as commit hashes. Otherwise, interpret as natural language.
-
Resolve the list of commit hashes from the input (see above).
-
Get the remote URL:
git remote get-url origin
-
Parse the remote URL into a base web URL:
- SSH format
git@host:owner/repo.git->https://host/owner/repo - HTTPS format
https://host/owner/repo.git->https://host/owner/repo - HTTPS with port
https://host:port/owner/repo.git->https://host:port/owner/repo - Strip trailing
.gitif present - Preserve custom ports (e.g.,
:3030) in the URL
- SSH format
-
For each commit hash:
- Resolve to short form via
git rev-parse --short <hash> - Construct the commit URL based on the platform:
Platform URL pattern GitHub ( github.com){base}/commit/{hash}GitLab ( gitlab.comor self-hosted){base}/-/commit/{hash}Bitbucket ( bitbucket.org){base}/commits/{hash}Azure DevOps ( dev.azure.com){base}/commit/{hash}Gitea / Forgejo (self-hosted) {base}/commit/{hash}Default (unknown host) {base}/commit/{hash} - Resolve to short form via
-
Output each URL on its own line. No markdown formatting, no extra text.