# Suggestion for 'git add' CLI

2 messages from 2022-07-11 to 2022-07-11. Participants: me@alirezaarabi.com, Junio C Hamano.
Thread: https://gitlist.dev/t/58130

## me@alirezaarabi.com, 2022-07-11 06:58

Subject: Suggestion for 'git add' CLI
Message-ID: <84b593cf1bacc4541a7a4ca24a5e98fa@alirezaarabi.com>
URL: https://gitlist.dev/e/84b593cf1bacc4541a7a4ca24a5e98fa%40alirezaarabi.com

```
hi there, I have a suggestion about git CLI.when I use 'git add -A' or 
'git add --all' it stages all of my files but when I use git add 
<file_name> it adds the file name to the stage, not all files. but when 
I use ' git add <file_name> --all ' it also works and adds all the files 
to the stage. I think it's better to provide a warning for this 
situation. thank you.

```

## Junio C Hamano, 2022-07-11 19:31

Subject: Re: Suggestion for 'git add' CLI
Message-ID: <xmqqsfn7o39i.fsf@gitster.g>
URL: https://gitlist.dev/e/xmqqsfn7o39i.fsf%40gitster.g
In-Reply-To: <84b593cf1bacc4541a7a4ca24a5e98fa@alirezaarabi.com>

```
me@alirezaarabi.com writes:

> hi there, I have a suggestion about git CLI.when I use 'git add -A' or
> 'git add --all' it stages all of my files but when I use git add 
> <file_name> it adds the file name to the stage, not all files. but
> when I use ' git add <file_name> --all ' it also works and adds all
> the files to the stage. I think it's better to provide a warning for
> this situation. thank you.

If "git add -A Documentation/" silently ignores the pathspec and
does not limit the application of "-A" to the Documentation
directory, then I think that is a bug worth fixing.

    $ git init trash && cd trash
    $ mkdir t s
    $ >t/1 && >s/2
    $ git add -A t
    $ git ls-files
    t/1

It does seem to honor the pathspec "t" and refrains from adding s/2
to the index, so I do not think there is anything to fix here,
though.

By the way, on the command line of "git", dashed command options
come before the non-dashed command line arguments, so make it a
habit to spell "git --add <file_name>".



```
