[PATCH v2 1/4] doc: git-add: start man page with an example

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 | 32 +++++++++++++++-----------------
 1 file changed, 15 insertions(+), 17 deletions(-)

diff --git a/Documentation/git-add.adoc b/Documentation/git-add.adoc
index b7a735824d6c..949b016e6fa2 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
 --------
@@ -16,18 +16,20 @@ git add [--verbose | -v] [--dry-run | -n] [--force | -f] [--interactive | -i] [-
 
 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 to prepare for a commit. The
+"index" (also known as "staging area") is where Git stores the changes
+that will be in the next 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
@@ -44,10 +46,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





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux