Skip to content

Commit 4065e48

Browse files
committed
Merge branch 'je/doc-add'
Documentation for "git add" has been updated. * je/doc-add: doc: rephrase the purpose of the staging area doc: git-add: simplify discussion of ignored files doc: git-add: clarify intro & add an example
2 parents ab427cd + e5c27bd commit 4065e48

File tree

1 file changed

+16
-18
lines changed

1 file changed

+16
-18
lines changed

Documentation/git-add.adoc

Lines changed: 16 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,18 @@ git add [--verbose | -v] [--dry-run | -n] [--force | -f] [--interactive | -i] [-
1616

1717
DESCRIPTION
1818
-----------
19-
This command updates the index using the current content found in
20-
the working tree, to prepare the content staged for the next commit.
21-
It typically adds the current content of existing paths as a whole,
22-
but with some options it can also be used to add content with
23-
only part of the changes made to the working tree files applied, or
24-
remove paths that do not exist in the working tree anymore.
25-
26-
The "index" holds a snapshot of the content of the working tree, and it
27-
is this snapshot that is taken as the contents of the next commit. Thus
28-
after making any changes to the working tree, and before running
29-
the commit command, you must use the `add` command to add any new or
30-
modified files to the index.
19+
Add contents of new or changed files to the index. The "index" (also
20+
known as the "staging area") is what you use to prepare the contents of
21+
the next commit.
22+
23+
When you run `git commit` without any other arguments, it will only
24+
commit staged changes. For example, if you've edited `file.c` and want
25+
to commit your changes to that file, you can run:
26+
27+
git add file.c
28+
git commit
29+
30+
You can also add only part of your changes to a file with `git add -p`.
3131

3232
This command can be performed multiple times before a commit. It only
3333
adds the content of the specified file(s) at the time the add command is
@@ -37,12 +37,10 @@ you must run `git add` again to add the new content to the index.
3737
The `git status` command can be used to obtain a summary of which
3838
files have changes that are staged for the next commit.
3939

40-
The `git add` command will not add ignored files by default. If any
41-
ignored files were explicitly specified on the command line, `git add`
42-
will fail with a list of ignored files. Ignored files reached by
43-
directory recursion or filename globbing performed by Git (quote your
44-
globs before the shell) will be silently ignored. The `git add` command can
45-
be used to add ignored files with the `-f` (force) option.
40+
The `git add` command will not add ignored files by default. You can
41+
use the `--force` option to add ignored files. If you specify the exact
42+
filename of an ignored file, `git add` will fail with a list of ignored
43+
files. Otherwise it will silently ignore the file.
4644

4745
Please see linkgit:git-commit[1] for alternative ways to add content to a
4846
commit.

0 commit comments

Comments
 (0)