vim-fugitive icon indicating copy to clipboard operation
vim-fugitive copied to clipboard

:Gbrowse when on remote

Open anderslemke opened this issue 12 years ago • 8 comments

First of all; Thank you for your awesome work making developing so much more fun for all of us!

I currently started developing on a remote machine, and pretty much got everything working as it was on my local machine.

I'm missing one thing, though; :Gbrowse.

Often because I'm looking at some specific lines of code, and want to send a link to my colleague like this:

https://github.com/org/repo/blob/master/file#L3-L5

I've tried setting up git web--browse to use lynx, but that doesn't seem to work.

All I need is that URL, so I can copy it, and send it off to someone else.

Do you have any suggestions as to how I might go about doing that?

Again, thank you.

Anders

anderslemke avatar Nov 06 '14 13:11 anderslemke

Uhm, :Gbrowse! apparently does the trick. :)

I'm sorry to waste your time.

Forget everything after "Thank you"...

anderslemke avatar Nov 06 '14 13:11 anderslemke

I've been looking for this for a while. I was sure Gbrowse used to work without the bang. Anyways, it does the trick. Thanks

lsaffie avatar Mar 18 '15 17:03 lsaffie

Looking for it in 2024. Can't believe it's so simple. Thanks.

su27 avatar Apr 23 '24 10:04 su27

:Gbrowse has been removed in favor of :GBrowse

I thought GBrowse wouldn't work with remotes different that origin, but then I found:

:GBrowse [...]@{remote} Force using the given remote rather than the remote                                                                                                                                                                                                                                                   
                        for the current branch.  The remote is used to                                                                                                                                                                                                                                                        
                        determine which upstream repository to link to. 

It would be awesome though if this used the "default remote", (i.e. git config remotes.default <remote>), because often my remotes names are set through google's repo tools, and hard to remember/type

kheaactua avatar Oct 30 '24 12:10 kheaactua

It would be awesome though if this used the "default remote", (i.e. git config remotes.default <remote>)

I don't see remotes.default anywhere in the git-config manpage.

tpope avatar Oct 30 '24 14:10 tpope

remotes.default

Hmm, I think I originally got that from an SO answer.. I do see it discussed on the git-remote page:

If neither group nor remote is specified on the command line, the configuration parameter remotes.default will be used; if remotes.default is not defined, all remotes which do not have the configuration parameter

It's been super helpful for me, we have build systems that define a bunch of remotes, so with this I can set the real one I'm interested in as the default for git push/pull/fetch

kheaactua avatar Oct 30 '24 14:10 kheaactua

Okay, so this remotes.default is a list of remotes that only affects git remote update with no arguments.

It's been super helpful for me, we have build systems that define a bunch of remotes, so with this I can set the real one I'm interested in as the default for git push/pull/fetch

Best I can tell it has zero effect on any of these commands. It's not clear what the effect would even be, since these commands only act on a single remote, not a list.

tpope avatar Oct 30 '24 16:10 tpope

Best I can tell it has zero effect on any of these commands. It's not clear what the effect would even be, since these commands only act on a single remote, not a list.

Hmm, this is embarrassing. I was about to copy/paste an example where I show this controlling what remote gets fetched from, but I figured I'd double check my aliases just to ensure I didn't have anything special going on.

Turns out I did replace my gf alias with a shell function that defaults the remote to the value of remotes.default config setting (that I also set.) So it seems that in 2021 I abstracted this and totally forgot.

Sorry about that.

kheaactua avatar Oct 30 '24 17:10 kheaactua