Improving the git remote command

5 messages, 3 authors, 2016-06-15 · open the first message on its own page

Improving the git remote command

From: Rémy Hubscher <hidden>
Date: 2016-06-15 23:02:21

Hi,

I'd like to add a list parameter to the `git remote` command.

We already have:
 
 - `git remote add`
 - `git remote rename`
 - `git remote delete`

I often write `git remote list` before finaly using `git remote -v` but
it isn't intuitive.

I am proposing to add `git remote list` as a shortcut for `git remote -v`

What do you think?

Rémy

Re: Improving the git remote command

From: Philippe Vaucher <hidden>
Date: 2016-06-15 23:02:21

I often write `git remote list` before finaly using `git remote -v` but
it isn't intuitive.

I am proposing to add `git remote list` as a shortcut for `git remote -v`
I suffer from the same problem. I think your proposal is a logical and
nice idea.

Philippe

Re: Improving the git remote command

From: Jeff King <hidden>
Date: 2016-06-15 23:02:21

On Tue, Aug 26, 2014 at 11:29:32AM +0200, Rémy Hubscher wrote:
I'd like to add a list parameter to the `git remote` command.

We already have:
 
 - `git remote add`
 - `git remote rename`
 - `git remote delete`

I often write `git remote list` before finaly using `git remote -v` but
it isn't intuitive.
Right now the list operation is done by giving no arguments at all. This
is a bit unlike other parts of git, which would usually define "git
remote list" and then say that if no command is given, "list" is the
default.

But...
I am proposing to add `git remote list` as a shortcut for `git remote -v`
This is somewhat different. I would have expected "git remote list" to
do the same thing as "git remote" (i.e., list without "-v"). I guess it
does not have to, though.

Perhaps "-v" should have been the default all along.  I do not use "git
remote" myself, so I don't know if "-v" is what most people use. But
changing the output of "git remote" now is probably a bad thing (I
expect some people may depend on parsing it to get the list of remotes;
they should probably use the git-config plumbing to do the same thing,
but it's actually rather tricky to do it that way).

-Peff

Re: Improving the git remote command

From: Philippe Vaucher <hidden>
Date: 2016-06-15 23:02:21

Perhaps "-v" should have been the default all along.  I do not use "git
remote" myself, so I don't know if "-v" is what most people use. But
changing the output of "git remote" now is probably a bad thing (I
expect some people may depend on parsing it to get the list of remotes;
they should probably use the git-config plumbing to do the same thing,
but it's actually rather tricky to do it that way).
Just to be clear, the proposal is not about changing the output of "git remote".

Anyway, it got me curious about other git commands reguarding "list",
and I was very surprised because I couldn't find another one. I mean
"git remote" actually behaves like "git branch" and "git tag". I have
no clue why I expect "list" to work with "git remote".

It's probably because "git branch" and "git tag" expect a name, and
there "list" can only be expressed by "no name" or with some flags. On
the other hand, "git remote" expects a subcommand (add, delete, etc)
and there what logically maps to "list" is the subcommand "list", "no
name" being more expected to produce a list of the subcommands.

Philippe

Re: Improving the git remote command

From: Jeff King <hidden>
Date: 2016-06-15 23:02:21

On Tue, Aug 26, 2014 at 06:19:20PM +0200, Philippe Vaucher wrote:
quoted
Perhaps "-v" should have been the default all along.  I do not use "git
remote" myself, so I don't know if "-v" is what most people use. But
changing the output of "git remote" now is probably a bad thing (I
expect some people may depend on parsing it to get the list of remotes;
they should probably use the git-config plumbing to do the same thing,
but it's actually rather tricky to do it that way).
Just to be clear, the proposal is not about changing the output of
"git remote".
I know. But we are left with three options:

  1. Add "git remote list" with verbose output. This is bad because it
     differs gratuitously from "git remote".

  2. Add "git remote list" with non-verbose output. This is good because
     it means "git remote" is just a shortcut for "git remote list",
     which is consistent with other parts of git. But it is potentially
     bad if "-v" is a better output format.

  3. Add "git remote list" with verbose output, and tweak "git remote"
     to match. This is bad because it breaks backwards compatibility.

The proposal is for (1). I think we agree that (3) is out. The question
is whether (1) or (2) is the least bad.
Anyway, it got me curious about other git commands reguarding "list",
and I was very surprised because I couldn't find another one. I mean
"git remote" actually behaves like "git branch" and "git tag". I have
no clue why I expect "list" to work with "git remote".
Branch and tag take "--list". Remote is the odd one out in that its
subcommands do not have dashes. git-stash also takes commands without
dashes (and has a list command), but its default mode is to create a
stash, not to list.
It's probably because "git branch" and "git tag" expect a name, and
there "list" can only be expressed by "no name" or with some flags. On
the other hand, "git remote" expects a subcommand (add, delete, etc)
and there what logically maps to "list" is the subcommand "list", "no
name" being more expected to produce a list of the subcommands.
Yeah. Branch and tag need dashed subcommands because otherwise it is
ambiguous with creating tag called "list", functionality that existed
before "--list" was added. Git-remote was defined with subcommands from
day one, so it can get away with it. Git-stash is sort of in the
category as git-remote there, except that "save" can actually take an
argument. So to provide it you can't say "git stash foobar", but instead
have to say "git stash save foobar" (it actually used to allow the
former, but you can imagine the annoyance when you typo "git stash
lsit").

-Peff
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help