git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH 1/2] Documentation: 'git add -A' can remove files

From
Junio C Hamano <gitster@pobox.com>
Date
Dec 6, 2009, 23:31 UTC
Message-ID
<7vr5r7el2q.fsf@alter.siamese.dyndns.org>
In-Reply-To
<4B1C384A.8000106@gmail.com>
Björn Gustavsson <bgustavsson@gmail.com> writes:
> Document that 'git add -A/--all' can remove files no longer
> present in the working tree from the index, and also document the
> behavior with and without path arguments on the command line.
Thanks.
Show 6 quoted lines
> +This command updates the index using the current content found in
> +the working tree, to prepare the content staged for the next commit.
> +It typically adds the current content of existing paths as a whole,
> +but with some options it can also be used to add content with
> +only part of the changes made to the working tree files applied, or
> +remove paths that do not exist in the work tree anymore.
You probably want to change the last one also to "working tree"?

I often write this as "work tree" without thinking too much about "work" vs "working", but if anybody asks me, I prefer the former because it is shorter and because it is more consistent with the way how names of the environment variable GIT_WORK_TREE and the configuration variable core.worktree are spelled. I personally am OK with either word used in the descriptive text, as there is no room for confusion.

But it would be better to be consistent in a single paragraph.
Show 14 quoted lines
>  -A::
>  --all::
> -	Update files that git already knows about (same as '\--update')
> -	and add all untracked files that are not ignored by '.gitignore'
> -	mechanism.
> -
> +	Update files that git already knows about (same as '\--update'),
> +	add all untracked files that are not ignored by the '.gitignore'
> +	mechanism and remove files from the index that are no longer
> +	present in the working tree.
> ++
> +If no paths are given on the command line, `git add -A` will operate
> +on the current directory and its subdirectories. If paths are given,
> +it will operate on those paths and their subdirectories.

The first line of the existing description for "--all", by saying "same as --update", refers to the first sentence of the corresponding entry for "update", which says:

    -u::
    --update::
            Update only files that git already knows about, staging modified
            content for commit and marking deleted files for removal. This
            is similar
            to what "git commit -a" does in preparation for making a commit,
            except that the update is limited to paths specified on the
            command line. If no paths are specified, all tracked files in the
            current directory and its subdirectories are updated.

In fact, "-A" is "do everything -u does, including removal of lost paths, honoring the pathspecs exactly the same way (e.g. no pathspec is to work in the current directory). but unlike -u, also add any new files that are not excluded by the ignore mechanism." There is something wrong if we have to spend more lines to describe "-A" than we describe "-u", if description of "-A" says "it does the same for -u, and in addition...".

I wonder if we can restructure the description of "-u" to make it easier to read, to simplify the description of "-A".

Previous: Björn GustavssonNext: Björn Steinbrink
Message 2 of 6 in “Documentation: 'git add -A' can remove files”
  1. 1/2 Documentation: 'git add -A' can remove filesBjörn Gustavsson, Dec 6, 2009
  2. Junio C HamanoDec 6, 2009
  3. Björn SteinbrinkDec 7, 2009
  4. Junio C HamanoDec 7, 2009
  5. Björn SteinbrinkDec 7, 2009
  6. Junio C HamanoDec 7, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.