git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Suggestion for 'git add' CLI
@ 2022-07-11  6:58 me
  2022-07-11 19:31 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: me @ 2022-07-11  6:58 UTC (permalink / raw)
  To: git

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Suggestion for 'git add' CLI
  2022-07-11  6:58 Suggestion for 'git add' CLI me
@ 2022-07-11 19:31 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2022-07-11 19:31 UTC (permalink / raw)
  To: me; +Cc: git

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>".



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-07-11 19:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-11  6:58 Suggestion for 'git add' CLI me
2022-07-11 19:31 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).