From: Julia Evans <julia@xxxxxxx> - Replace the intro paragraph of the `git-add` man page with an example to try to clarify it for new users. The goal here is use less jargon but communicate essentially the same information. - Give an example of how to add only part of the changes to the file - Remove the snapshot-based explanation of the index and replace it with a diff-based explanation because I don't feel that it's useful in this context to emphasize that git uses a snapshot-based model: the main way most git users interact with the index is through `git diff` or `git status`, which is a completely diff-based view of the index. Signed-off-by: Julia Evans <julia@xxxxxxx> --- Documentation/git-add.adoc | 31 ++++++++++++++----------------- 1 file changed, 14 insertions(+), 17 deletions(-) diff --git a/Documentation/git-add.adoc b/Documentation/git-add.adoc index 12afeead6637..99ca2d0f7e21 100644 --- a/Documentation/git-add.adoc +++ b/Documentation/git-add.adoc @@ -3,7 +3,7 @@ git-add(1) NAME ---- -git-add - Add file contents to the index +git-add - Add new or changed files to the index SYNOPSIS -------- @@ -12,18 +12,19 @@ git add [<options>] [--] [<pathspec>...] DESCRIPTION ----------- -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 working tree anymore. - -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 -after making any changes to the working tree, and before running -the commit command, you must use the `add` command to add any new or -modified files to the index. +Add new or changed files to the index (also known as "staging area") to +prepare for a commit. + +By default, `git commit` only commits changes that you've added to the +index. For example, if you've edited `file.c` and want to commit your +changes, you can run: + + git add file.c + git commit + +You can also add only part of your changes to a file with `git add -p`. +Please see linkgit:git-commit[1] for alternative ways to add content to +a commit. This command can be performed multiple times before a commit. It only adds the content of the specified file(s) at the time the add command is @@ -40,10 +41,6 @@ directory recursion or filename globbing performed by Git (quote your globs before the shell) will be silently ignored. The `git add` command can be used to add ignored files with the `-f` (force) option. -Please see linkgit:git-commit[1] for alternative ways to add content to a -commit. - - OPTIONS ------- `<pathspec>...`:: -- gitgitgadget