|
2 | 2 | .\" Title: git-add |
3 | 3 | .\" Author: [FIXME: author] [see http://www.docbook.org/tdg5/en/html/author] |
4 | 4 | .\" Generator: DocBook XSL Stylesheets v1.79.2 <http://docbook.sf.net/> |
5 | | -.\" Date: 2025-09-10 |
| 5 | +.\" Date: 2025-09-12 |
6 | 6 | .\" Manual: Git Manual |
7 | | -.\" Source: Git 2.51.0.210.gab427cd991 |
| 7 | +.\" Source: Git 2.51.0.244.g92c87bdc40 |
8 | 8 | .\" Language: English |
9 | 9 | .\" |
10 | | -.TH "GIT\-ADD" "1" "2025-09-10" "Git 2\&.51\&.0\&.210\&.gab427c" "Git Manual" |
| 10 | +.TH "GIT\-ADD" "1" "2025-09-12" "Git 2\&.51\&.0\&.244\&.g92c87b" "Git Manual" |
11 | 11 | .\" ----------------------------------------------------------------- |
12 | 12 | .\" * Define some portability stuff |
13 | 13 | .\" ----------------------------------------------------------------- |
@@ -40,15 +40,28 @@ git-add \- Add file contents to the index |
40 | 40 | .fi |
41 | 41 | .SH "DESCRIPTION" |
42 | 42 | .sp |
43 | | -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\&. |
| 43 | +Add contents of new or changed files to the index\&. The "index" (also known as the "staging area") is what you use to prepare the contents of the next commit\&. |
44 | 44 | .sp |
45 | | -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 \fBadd\fR command to add any new or modified files to the index\&. |
| 45 | +When you run \fBgit\fR\fBcommit\fR without any other arguments, it will only commit staged changes\&. For example, if you\(cqve edited \fBfile\&.c\fR and want to commit your changes to that file, you can run: |
| 46 | +.sp |
| 47 | +.ifn\{\ |
| 48 | +.RS4 |
| 49 | +.\} |
| 50 | +.nf |
| 51 | +git add file\&.c |
| 52 | +git commit |
| 53 | +.fi |
| 54 | +.ifn\{\ |
| 55 | +.RE |
| 56 | +.\} |
| 57 | +.sp |
| 58 | +You can also add only part of your changes to a file with \fBgit\fR\fBadd\fR\fB\-p\fR\&. |
46 | 59 | .sp |
47 | 60 | 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 run; if you want subsequent changes included in the next commit, then you must run \fBgit\fR\fBadd\fR again to add the new content to the index\&. |
48 | 61 | .sp |
49 | 62 | The \fBgit\fR\fBstatus\fR command can be used to obtain a summary of which files have changes that are staged for the next commit\&. |
50 | 63 | .sp |
51 | | -The \fBgit\fR\fBadd\fR command will not add ignored files by default\&. If any ignored files were explicitly specified on the command line, \fBgit\fR\fBadd\fRwill fail with a list of ignored files\&. Ignored files reached by directory recursion or filename globbing performed by Git (quote your globs before the shell) will be silently ignored\&. The\fBgit\fR\fBadd\fRcommand can be used to add ignored files with the \fB\-f\fR (force) option\&. |
| 64 | +The \fBgit\fR\fBadd\fR command will not add ignored files by default\&. You can use the \fB\-\-force\fRoption to add ignored files\&. If you specify the exact filename of an ignored file,\fBgit\fR\fBadd\fRwill fail with a list of ignored files\&. Otherwise it will silently ignore the file\&. |
52 | 65 | .sp |
53 | 66 | Please see \fBgit-commit\fR(1) for alternative ways to add content to a commit\&. |
54 | 67 | .SH "OPTIONS" |
|
0 commit comments