# git diff autocomplete

4 messages from 2019-08-18 to 2019-08-26. Participants: Dhaval Patel, Santiago Torres Arias, Andreas Schwab.
Thread: https://gitlist.dev/t/51662

## Dhaval Patel, 2019-08-18 02:44

Subject: git diff autocomplete
Message-ID: <CADSGPzV+dfNR=epmz2whKkrpiH=JMUR4gVjpZ+x+kzKrX0kD-A@mail.gmail.com>
URL: https://gitlist.dev/e/CADSGPzV%2BdfNR%3Depmz2whKkrpiH%3DJMUR4gVjpZ%2Bx%2BkzKrX0kD-A%40mail.gmail.com

```
How to reproduce

git init
touch abc.txt
touch abd.txt
git add a*
git commit -m 'first commit'
echo 'hello' > abc.txt
git add a[PRESS TAB]
(This will autocomplete 'git add abc.txt')
git diff a[PRESS TAB]
(This will not give 'git diff abc.txt')

Suggested feature -

when I press tab, git diff should autocomplete just like git add.

```

## Santiago Torres Arias, 2019-08-18 02:47

Subject: Re: git diff autocomplete
Message-ID: <20190818024757.765fx3tdfekseim5@LykOS.localdomain>
URL: https://gitlist.dev/e/20190818024757.765fx3tdfekseim5%40LykOS.localdomain
In-Reply-To: <CADSGPzV+dfNR=epmz2whKkrpiH=JMUR4gVjpZ+x+kzKrX0kD-A@mail.gmail.com>

```
On Sun, Aug 18, 2019 at 08:14:15AM +0530, Dhaval Patel wrote:
> How to reproduce
> 
> [snip]
> Suggested feature -
> 
> when I press tab, git diff should autocomplete just like git add.

I think this is somewhat harder of a usecase, as git add generally takes
paths and diff can compare revisions *and* paths. I see that if I do

    git diff -- [TAB]

I get all the paths as an autocomplete option, which I think is desired
behavior.

Thanks,
-Santiago.

```

## Dhaval Patel, 2019-08-26 15:48

Subject: git diff autocomplete
Message-ID: <CADSGPzVgweL4tCEqg3LvfXbp=HZyQ7BngKpVrFp0_0SFJZVezQ@mail.gmail.com>
URL: https://gitlist.dev/e/CADSGPzVgweL4tCEqg3LvfXbp%3DHZyQ7BngKpVrFp0_0SFJZVezQ%40mail.gmail.com
In-Reply-To: <CADSGPzU6+AdMtrEnc98SHASmcmxGsj52Y99Dd5zvkOeRqWS-jQ@mail.gmail.com>

```
If it is only about files and revisions both being handled by git
diff, would it not ne possible to do something like this?

For files

git diff -f a[PRESS TAB]

For revisions

git diff -r a[PRESS TAB]

Some sort of flag which says we are handling files or revisions.

```

## Andreas Schwab, 2019-08-26 17:09

Subject: Re: git diff autocomplete
Message-ID: <87mufvzwen.fsf@igel.home>
URL: https://gitlist.dev/e/87mufvzwen.fsf%40igel.home
In-Reply-To: <CADSGPzVgweL4tCEqg3LvfXbp=HZyQ7BngKpVrFp0_0SFJZVezQ@mail.gmail.com>

```
On Aug 26 2019, Dhaval Patel <drdhaval2785@gmail.com> wrote:

> If it is only about files and revisions both being handled by git
> diff, would it not ne possible to do something like this?
>
> For files
>
> git diff -f a[PRESS TAB]
>
> For revisions
>
> git diff -r a[PRESS TAB]
>
> Some sort of flag which says we are handling files or revisions.

That already exists, it is spelt `--'.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

```
