-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
The current git-browse script support opening the current git repo website of a given remote (default is origin) in the browser.
It would be a great addition if the script also supported opening the current git repo website at a specific file and line number(s).
Using current repo as an example:
# same behavior as today
$ git browse
# opens https://github.com/pbnj/git-extras (my origin remote url)
# open repo of a given remote
$ git browse upstream
# opens https://github.com/tj/git-extras
# open repo at file of current branch of a given remote
$ git browse origin bin/git-browse
# opens https://github.com/pbnj/git-extras/blob/master/bin/git-browse
# open repo at file & line number of current branch of a given remote
$ git browse origin bin/git-browse 42
# opens https://github.com/pbnj/git-extras/blob/master/bin/git-browse#L42
# open repo at file & line range of current branch of a given remote
$ git browse origin bin/git-browse 1 42
# opens https://github.com/pbnj/git-extras/blob/master/bin/git-browse#L1-L42Here is how I accomplished this in another bash script: https://github.com/pbnj/dotfiles/blob/f544dadf8833d6687ac5d8dfc14c59d5890498a7/git/bin/git-browse
If there is agreement that we want this feature, I can port it over and submit a PR.
I imagine the challenge/complexity mostly being around how (if at all) we can make this logic as agnostic as possible so as to not have to maintain platform-specific logic for each one out there (e.g. github, gitlab, bitbucket, sr.ht, gitee, gitea, ...etc)