git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: me@alirezaarabi.com
Cc: git@vger.kernel.org
Subject: Re: Suggestion for 'git add' CLI
Date: Mon, 11 Jul 2022 12:31:05 -0700	[thread overview]
Message-ID: <xmqqsfn7o39i.fsf@gitster.g> (raw)
In-Reply-To: <84b593cf1bacc4541a7a4ca24a5e98fa@alirezaarabi.com> (me@alirezaarabi.com's message of "Mon, 11 Jul 2022 11:28:21 +0430")

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



      reply	other threads:[~2022-07-11 19:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-11  6:58 Suggestion for 'git add' CLI me
2022-07-11 19:31 ` Junio C Hamano [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqsfn7o39i.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=me@alirezaarabi.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).