Browse Source

Documentation: 'git add -A' can remove files

The current documentation fails to mention that 'git add -A/--all' can
remove files as well as add them, and it also does not say anything about
filepatterns (whether they are allowed, mandatory, or optional). It is
also not clear what the similarities and differences to the -u option are.

Update the intro paragraph (as suggested by Junio, with some minor edits)
to make it clear that 'git add' is able to delete and to also cover the -p
option.

Reword the description of -u to make it clearer (based on Björn
Steinbrink's suggestion).

Simplify the description of -A by saying "Like -u" and then describe the
differences (based on the suggestions by Björn Steinbrink and Junio).

Signed-off-by: Björn Gustavsson <bgustavsson@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
maint
Björn Gustavsson 15 years ago committed by Junio C Hamano
parent
commit
968d70723a
  1. 33
      Documentation/git-add.txt

33
Documentation/git-add.txt

@ -14,8 +14,12 @@ SYNOPSIS


DESCRIPTION DESCRIPTION
----------- -----------
This command adds the current content of new or modified files to the This command updates the index using the current content found in
index, thus staging that content for inclusion in the next commit. 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 working tree anymore.


The "index" holds a snapshot of the content of the working tree, and it The "index" holds a snapshot of the content of the working tree, and it
is this snapshot that is taken as the contents of the next commit. Thus is this snapshot that is taken as the contents of the next commit. Thus
@ -92,20 +96,23 @@ apply.


-u:: -u::
--update:: --update::
Update only files that git already knows about, staging modified Only match <filepattern> against already tracked files in
content for commit and marking deleted files for removal. This the index rather than the working tree. That means that it
is similar will never stage new files, but that it will stage modified
to what "git commit -a" does in preparation for making a commit, new contents of tracked files and that it will remove files
except that the update is limited to paths specified on the from the index if the corresponding files in the working tree
command line. If no paths are specified, all tracked files in the have been removed.
current directory and its subdirectories are updated. +
If no <filepattern> is given, default to "."; in other words,
update all tracked files in the current directory and its
subdirectories.


-A:: -A::
--all:: --all::
Update files that git already knows about (same as '\--update') Like `-u`, but match <filepattern> against files in the
and add all untracked files that are not ignored by '.gitignore' working tree in addition to the index. That means that it
mechanism. will find new files as well as staging modified content and

removing files that are no longer in the working tree.


-N:: -N::
--intent-to-add:: --intent-to-add::

Loading…
Cancel
Save