# UI and git-completion.sh

13 messages from 2007-10-23 to 2007-10-24. Participants: Paolo Ciarrocchi, Steven Grimm, Randal L. Schwartz, Matthieu Moy, Brian Downing, Johannes Schindelin, Pierre Habouzit, Johannes Gilger.
Thread: https://gitlist.dev/t/10443

## Paolo Ciarrocchi, 2007-10-23 21:46

Subject: UI and git-completion.sh
Message-ID: <20071023234617.45a4fc64@paolo-desktop>
URL: https://gitlist.dev/e/20071023234617.45a4fc64%40paolo-desktop

```
Hi all,
I just asked for help on the #git irc channel in order to install
the .git-completion.sh script (thanks nessundorma) and after using it 
for a while I started wondering why I cannot find any reference to it the 
official documentation.
The only important think that git grep found is:
	paolo@paolo-desktop:~/git$ git grep completion *
	Documentation/RelNotes-1.5.0.txt: - Bash completion scripts have been updated heavily.
Shouldn't it be mentioned somewhere? 

I know that newbies are somehow scared by the following:
	paolo@paolo-desktop:~/git$ git-
	Display all 151 possibilities? (y or n)
What? Do I have to learn 151 commands?
No way!

Using the git-completation script it all boils down to 48 commands.

paolo@paolo-desktop:~/git$ git 
add                   fetch                 rebase 
am                    filter-branch         rebase--interactive 
annotate              format-patch          relink 
apply                 fsck                  remote 
archive               gc                    repack 
bisect                get-tar-commit-id     request-pull 
blame                 grep                  reset 
branch                gui                   resolve 
bundle                imap-send             revert 
checkout              init                  rm 
checkout-index        instaweb              send-email 
cherry                log                   shortlog 
cherry-pick           lost-found            show 
citool                ls-files              show-branch 
clean                 ls-remote             show-ref 
clone                 ls-tree               stash 
commit                merge                 status 
config                mergetool             submodule 
convert-objects       mv                    tag 
count-objects         name-rev              var 
describe              pickaxe               verify-pack 
diff                  pull                  whatchanged 
diff-stages           push

And I think I can remove some commands from the list.

What people think about starting suggesting the usage of the script in the documentation?
I just want to know the opinion of the list before trying to write a documentation patch.
Next step would be to reduce the number of the items listed by git <tab> but I know there is 
already a discussion about it on the list.

Regards,
		Paolo

```

## Steven Grimm, 2007-10-23 22:00

Subject: Re: UI and git-completion.sh
Message-ID: <471E6EF0.2060403@midwinter.com>
URL: https://gitlist.dev/e/471E6EF0.2060403%40midwinter.com
In-Reply-To: <20071023234617.45a4fc64@paolo-desktop>

```
Paolo Ciarrocchi wrote:
> What people think about starting suggesting the usage of the script in the documentation?
>   
Also might be worth mentioning the zsh completion support. (I know it's 
there, but haven't used it -- maybe its author would care to describe it 
a bit?)

-Steve

```

## Randal L. Schwartz, 2007-10-23 23:44

Subject: Re: UI and git-completion.sh
Message-ID: <86ve8x9z1f.fsf@blue.stonehenge.com>
URL: https://gitlist.dev/e/86ve8x9z1f.fsf%40blue.stonehenge.com
In-Reply-To: <471E6EF0.2060403@midwinter.com>

```
>>>>> "Steven" == Steven Grimm <koreth@midwinter.com> writes:

Steven> Also might be worth mentioning the zsh completion support. (I know it's there,
Steven> but haven't used it -- maybe its author would care to describe it a bit?)

Where is it?  I'm a zsh user, and would love to have git support.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

```

## Matthieu Moy, 2007-10-23 23:54

Subject: Re: UI and git-completion.sh
Message-ID: <vpqir4xgzep.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqir4xgzep.fsf%40bauges.imag.fr
In-Reply-To: <86ve8x9z1f.fsf@blue.stonehenge.com>

```
merlyn@stonehenge.com (Randal L. Schwartz) writes:

>>>>>> "Steven" == Steven Grimm <koreth@midwinter.com> writes:
>
> Steven> Also might be worth mentioning the zsh completion support. (I know it's there,
> Steven> but haven't used it -- maybe its author would care to describe it a bit?)
>
> Where is it?  I'm a zsh user, and would love to have git support.

In zsh itself.

Completion/Unix/Command/_git

-- 
Matthieu

```

## Randal L. Schwartz, 2007-10-24 00:01

Subject: Re: UI and git-completion.sh
Message-ID: <86prz59y9s.fsf@blue.stonehenge.com>
URL: https://gitlist.dev/e/86prz59y9s.fsf%40blue.stonehenge.com
In-Reply-To: <vpqir4xgzep.fsf@bauges.imag.fr>

```
>>>>> "Matthieu" == Matthieu Moy <Matthieu.Moy@imag.fr> writes:

Matthieu> In zsh itself.

Matthieu> Completion/Unix/Command/_git

Not in my version of zsh.  Any chance I can add that to my 4.2.3 installation?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

```

## Randal L. Schwartz, 2007-10-24 00:31

Subject: Re: UI and git-completion.sh
Message-ID: <86d4v59wvt.fsf@blue.stonehenge.com>
URL: https://gitlist.dev/e/86d4v59wvt.fsf%40blue.stonehenge.com
In-Reply-To: <471E91C9.3000004@midwinter.com>

```
>>>>> "Steven" == Steven Grimm <koreth@midwinter.com> writes:

Steven> And I think we've just proven that more documentation is required
Steven> here! (I have no idea how to enable it myself; I just know I've seen
Steven> it mentioned on the list from time to time.)

Yes, so what is the process of adding the git zsh completion to any relatively
stable version of zsh?  Someone here must know.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

```

## Matthieu Moy, 2007-10-24 00:46

Subject: Re: UI and git-completion.sh
Message-ID: <vpqbqapgx0j.fsf@bauges.imag.fr>
URL: https://gitlist.dev/e/vpqbqapgx0j.fsf%40bauges.imag.fr
In-Reply-To: <86prz59y9s.fsf@blue.stonehenge.com>

```
merlyn@stonehenge.com (Randal L. Schwartz) writes:

>>>>>> "Matthieu" == Matthieu Moy <Matthieu.Moy@imag.fr> writes:
>
> Matthieu> In zsh itself.
>
> Matthieu> Completion/Unix/Command/_git
>
> Not in my version of zsh.  Any chance I can add that to my 4.2.3
> installation?

http://zsh.cvs.sourceforge.net/zsh/zsh/Completion/Unix/Command/_git

Try adding it to your $fpath, hopefully, the new _git doesn't use the
other new zsh features, and it will work (I have a CVS _git with a
4.3.4 zsh, and it works like a charm).

-- 
Matthieu

```

## Randal L. Schwartz, 2007-10-24 00:50

Subject: Re: UI and git-completion.sh
Message-ID: <868x5t9w02.fsf@blue.stonehenge.com>
URL: https://gitlist.dev/e/868x5t9w02.fsf%40blue.stonehenge.com
In-Reply-To: <vpqbqapgx0j.fsf@bauges.imag.fr>

```
>>>>> "Matthieu" == Matthieu Moy <Matthieu.Moy@imag.fr> writes:

Matthieu> http://zsh.cvs.sourceforge.net/zsh/zsh/Completion/Unix/Command/_git

Matthieu> Try adding it to your $fpath, hopefully, the new _git doesn't use the
Matthieu> other new zsh features, and it will work (I have a CVS _git with a
Matthieu> 4.3.4 zsh, and it works like a charm).

Do I add it as _git below my $fpath?  Or do I need to put it into a subdir?
How will it know it is there?

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!

```

## Brian Downing, 2007-10-24 00:55

Subject: Re: UI and git-completion.sh
Message-ID: <20071024005549.GC24924@lavos.net>
URL: https://gitlist.dev/e/20071024005549.GC24924%40lavos.net
In-Reply-To: <86d4v59wvt.fsf@blue.stonehenge.com>

```
On Tue, Oct 23, 2007 at 05:31:02PM -0700, Randal L. Schwartz wrote:
> Yes, so what is the process of adding the git zsh completion to any
> relatively stable version of zsh?  Someone here must know.

I dunno the "right" way to do it, but I had this in my .zshrc file that
I presumably cargo-culted from somewhere:

    fpath=( $HOME/.zsh/compfuncs $fpath )

So in addition to that, doing:

    wget -O ~/.zsh/compfuncs/_git 'http://zsh.cvs.sourceforge.net/*checkout*/zsh/zsh/Completion/Unix/Command/_git'

might get you something.  I guess if your zsh is too old it might be
incompatible with the completion script, though...

-bcd

```

## Brian Downing, 2007-10-24 00:57

Subject: Re: UI and git-completion.sh
Message-ID: <20071024005711.GD24924@lavos.net>
URL: https://gitlist.dev/e/20071024005711.GD24924%40lavos.net
In-Reply-To: <20071024005549.GC24924@lavos.net>

```
On Tue, Oct 23, 2007 at 07:55:49PM -0500, Brian Downing wrote:
> I dunno the "right" way to do it, but I had this in my .zshrc file that
> I presumably cargo-culted from somewhere:
> 
>     fpath=( $HOME/.zsh/compfuncs $fpath )

I think this has to come before "compinit" or whatever starts up the new
completion engine.

-bcd

```

## Johannes Schindelin, 2007-10-24 10:20

Subject: Re: UI and git-completion.sh
Message-ID: <Pine.LNX.4.64.0710241113190.25221@racer.site>
URL: https://gitlist.dev/e/Pine.LNX.4.64.0710241113190.25221%40racer.site
In-Reply-To: <20071023234617.45a4fc64@paolo-desktop>

```
Hi,

On Tue, 23 Oct 2007, Paolo Ciarrocchi wrote:

> Using the git-completation script it all boils down to 48 commands.
> 
> paolo@paolo-desktop:~/git$ git 
> add                   fetch                 rebase 
> am                    filter-branch         rebase--interactive 
> annotate              format-patch          relink 
> apply                 fsck                  remote 
> archive               gc                    repack 
> bisect                get-tar-commit-id     request-pull 
> blame                 grep                  reset 
> branch                gui                   resolve 
> bundle                imap-send             revert 
> checkout              init                  rm 
> checkout-index        instaweb              send-email 
> cherry                log                   shortlog 
> cherry-pick           lost-found            show 
> citool                ls-files              show-branch 
> clean                 ls-remote             show-ref 
> clone                 ls-tree               stash 
> commit                merge                 status 
> config                mergetool             submodule 
> convert-objects       mv                    tag 
> count-objects         name-rev              var 
> describe              pickaxe               verify-pack 
> diff                  pull                  whatchanged 
> diff-stages           push

diff-stages just struck my eye.  It is no longer in git...  But AFAICS it 
is no longer in git-completion.bash either.

Besides, I think that the number of commands could be reduced further.  
For example, I think that a regular user does not want to see

checkout-index, citool, convert-objects, filter-branch, get-tar-commit-id, 
imap-send, instaweb, lost-found, ls-tree, name-rev, rebase--interactive, 
relink, repack, request-pull, show-ref, var, verify-pack and whatchanged.

This list was not vs the quoted list, but my current list (pretty much tip 
of Shawn's "next".

Note: I would like to complete the _options_ when one of these subcommands 
was specified, but I just do not want to see them when entering 
"git<SPACE><TAB>".

BTW Pierre's idea of generating many (if not all) of these completions on 
the fly (maybe with "--help-completion"?) is intriguing.

Ciao,
Dscho

```

## Pierre Habouzit, 2007-10-24 17:07

Subject: Re: UI and git-completion.sh
Message-ID: <20071024170706.GA29387@artemis.corp>
URL: https://gitlist.dev/e/20071024170706.GA29387%40artemis.corp
In-Reply-To: <Pine.LNX.4.64.0710241113190.25221@racer.site>

```
On Wed, Oct 24, 2007 at 10:20:07AM +0000, Johannes Schindelin wrote:
> BTW Pierre's idea of generating many (if not all) of these completions on 
> the fly (maybe with "--help-completion"?) is intriguing.

  To be fair, it's not my idea, I'm just bought to it.

-- 
·O·  Pierre Habouzit
··O                                                madcoder@debian.org
OOO                                                http://www.madism.org

```

## Johannes Gilger, 2007-10-24 17:34

Subject: Re: UI and git-completion.sh
Message-ID: <471F8241.50308@hackvalue.de>
URL: https://gitlist.dev/e/471F8241.50308%40hackvalue.de
In-Reply-To: <86ve8x9z1f.fsf@blue.stonehenge.com>

```
Randal L. Schwartz wrote:
> Where is it?  I'm a zsh user, and would love to have git support.
> 

Another way to get git-completion support with zsh (works with 4.3.2) is to use 
the existing bash-completion and enable bash-completion for zsh via:
autoload bashcompinit
bashcompinit
in your .zshrc or similar. Btw, if you use gentoo you can install git with bash-completion, 
although i suppose that most people here are not using emerge to get their git ;).

Greetings,
Johannes

-- 
Johannes Gilger <heipei@hackvalue.de>
http://hackvalue.de/heipei/
GPG-Key: 0x42F6DE81
GPG-Fingerprint: BB49 F967 775E BB52 3A81  882C 58EE B178 42F6 DE81

```
