Skip to content

Commit 9e46e2e

Browse files
committed
add ghcommiturl alias
1 parent 6216231 commit 9e46e2e

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

zsh/.zshrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,12 @@ alias ghprurl='gh pr view --json url | jq -r .url'
206206
alias ghpropen='gh pr view --web'
207207
# get repo url
208208
alias ghrepourl='gh repo view --json url | jq -r .url'
209+
# get github commit url for HEAD or a given rev
210+
function ghcommiturl() {
211+
local sha
212+
sha=$(git rev-parse "${1:-HEAD}") || return 1
213+
echo "$(gh repo view --json url -q .url)/commit/${sha}"
214+
}
209215

210216
# Other aliases
211217

0 commit comments

Comments
 (0)