# Feature request: short cuts for git add /diff etc

3 messages from 2012-09-04 to 2012-09-04. Participants: Коньков Евгений, Nazri Ramliy, Junio C Hamano.
Thread: https://gitlist.dev/t/31425

## Коньков Евгений, 2012-09-04 11:25

Subject: Feature request: short cuts for git add /diff etc
Message-ID: <6110218480.20120904152542@reg.ru>
URL: https://gitlist.dev/e/6110218480.20120904152542%40reg.ru

```
Hi, Git

Change this:
# git status
# On branch yandex_mail_new_api
# Your branch is ahead of 'origin/yandex_mail_new_api' by 2 commits.
#
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified:   a1.txt
#       modified:   a2.txt
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#       new.txt

to this:

# git status
# On branch yandex_mail_new_api
# Your branch is ahead of 'origin/yandex_mail_new_api' by 2 commits.
#
# Changes not staged for commit:
#   (use "git add <file>..." to update what will be committed)
#   (use "git checkout -- <file>..." to discard changes in working directory)
#
#       modified(1):   a1.txt
#       modified(2):   a2.txt
#
# Untracked files:
#   (use "git add <file>..." to include in what will be committed)
#
#   (3)    new.txt


sot this allow:
git diff 1       same as        git diff a1.txt
git diff 2       same as        git diff a2.txt

git add 1        same as        git add a1.txt
in case there are may be files with such names I may appply option -s,for example
git add [ -s | --stage ] 1 . This will force to add file from list of
'git status' and do not use '1' as file name.

git add 3        same as         git add new.txt


This very handy and will keep developer from useless typing =)

-- 
 С уважением,
 Коньков Евгений
 Программист
 Регистратор доменных имен REG.RU
 Телефон: +38 (097) 7654-676
 www.reg.ru
 ___________________
 Sincerely yours,
 Konkov Eugen
 Developer
 Accredited domain Registrar REG.RU, LLC.
 Phone: +38 (097) 7654-676
 www.reg.ru/en/

mailto:kes@reg.ru

```

## Nazri Ramliy, 2012-09-04 11:51

Subject: Re: Feature request: short cuts for git add /diff etc
Message-ID: <CAEY4ZpOw2HUCf6QxUaAQTjCCVxi_TvttW1DFOgrsgbo6PQtfZw@mail.gmail.com>
URL: https://gitlist.dev/e/CAEY4ZpOw2HUCf6QxUaAQTjCCVxi_TvttW1DFOgrsgbo6PQtfZw%40mail.gmail.com
In-Reply-To: <6110218480.20120904152542@reg.ru>

```
On Tue, Sep 4, 2012 at 7:25 PM, Коньков Евгений <kes@reg.ru> wrote:
> sot this allow:
> git diff 1       same as        git diff a1.txt
> git diff 2       same as        git diff a2.txt
>
> git add 1        same as        git add a1.txt
> in case there are may be files with such names I may appply option -s,for example
> git add [ -s | --stage ] 1 . This will force to add file from list of
> 'git status' and do not use '1' as file name.
>
> git add 3        same as         git add new.txt
>
>
> This very handy and will keep developer from useless typing =)

Check out git-number[1] and scm_breeze[2]. Both provides similar
functionality to the above.

nazri
shameless disclaimer: I wrote git-number.

[1] https://github.com/holygeek/git-number
[2] https://github.com/ndbroadbent/scm_breeze

```

## Junio C Hamano, 2012-09-04 18:03

Subject: Re: Feature request: short cuts for git add /diff etc
Message-ID: <7vehmhbr7p.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vehmhbr7p.fsf%40alter.siamese.dyndns.org
In-Reply-To: <6110218480.20120904152542@reg.ru>

```
Коньков Евгений <kes@reg.ru> writes:

> # git status
> # On branch yandex_mail_new_api
> # Your branch is ahead of 'origin/yandex_mail_new_api' by 2 commits.
> #
> # Changes not staged for commit:
> #   (use "git add <file>..." to update what will be committed)
> #   (use "git checkout -- <file>..." to discard changes in working directory)
> #
> #       modified(1):   a1.txt
> #       modified(2):   a2.txt
> #
> # Untracked files:
> #   (use "git add <file>..." to include in what will be committed)
> #
> #   (3)    new.txt
>
>
> sot this allow:
> git diff 1       same as        git diff a1.txt
> git diff 2       same as        git diff a2.txt
>
> git add 1        same as        git add a1.txt
> in case there are may be files with such names I may appply option -s,for example
> git add [ -s | --stage ] 1 . This will force to add file from list of
> 'git status' and do not use '1' as file name.
>
> git add 3        same as         git add new.txt
>
> This very handy and will keep developer from useless typing =)

When I know I want to add a1.txt, I can say "git add a1.txt", but
with your version of Git, I now have to say "git status" to first
find out what file number a1.txt corresponds to so that I can say
"git add 1"?  Worse yet, after saying "git diff 1" to check the
progress of a1.txt, which may be long and scroll the output from
"git status" off the top of my screen, I need to run "git status"
again to see what file number a2.txt corresponds to?

That does not make any sense even as a typesaver.  Besides, what if
I have a file whose name is "1" that I would want to add?

You may be looking for either "git gui", or "git add -i" (if you do
not like a windowed environment), both of which would let you choose
pathnames with fewer keystrokes.

```
