git add [pathspec...]

Add file contents to the index

Arguments

NameDescription
pathspec

Options

NameDescription
-n, --dry-runDon’t actually add the file(s), just show if they exist and/or will be ignored
-v, --verboseBe verbose
-f, --forceAllow adding otherwise ignored files
-i, --interactiveAdd modified contents in the working tree interactively to the index. Optional path arguments may be supplied to limit operation to a subset of the working tree. See “Interactive mode” for details
-p, --patchInteractively choose hunks of patch between the index and the work tree and add them to the index. This gives the user a chance to review the difference before adding modified contents to the index
-e, --editOpen the diff vs. the index in an editor and let the user edit it. After the editor was closed, adjust the hunk headers and apply the patch to the index
-u, --updateUpdate the index just where it already has an entry matching <pathspec>. This removes as well as modifies index entries to match the working tree, but adds no new files
-A, --all, --no-ignore-removalUpdate the index not only where the working tree has a file matching <pathspec> but also where the index already has an entry. This adds, modifies, and removes index entries to match the working tree
--no-all, --ignore-removalUpdate the index by adding new files that are unknown to the index and files modified in the working tree, but ignore files that have been removed from the working tree. This option is a no-op when no <pathspec> is used
-N, --intent-to-addRecord only the fact that the path will be added later. An entry for the path is placed in the index with no content. This is useful for, among other things, showing the unstaged content of such files with git diff and committing them with git commit -a
--refreshDon’t add the file(s), but only refresh their stat() information in the index
--ignore-errorsIf some files could not be added because of errors indexing them, do not abort the operation, but continue adding the others. The command shall still exit with non-zero status. The configuration variable add.ignoreErrors can be set to true to make this the default behaviour
--ignore-missingThis option can only be used together with --dry-run. By using this option the user can check if any of the given files would be ignored, no matter if they are already present in the work tree or not
--no-warn-embedded-repoBy default, git add will warn when adding an embedded repository to the index without using git submodule add to create an entry in .gitmodules. This option will suppress the warning (e.g., if you are manually performing operations on submodules)
--renormalizeApply the 'clean' process freshly to all tracked files to forcibly add them again to the index. This is useful after changing core.autocrlf configuration or the text attribute in order to correct files added with wrong CRLF/LF line endings. This option implies -u
--chmod <arg>Override the executable bit of the added files. The executable bit is only changed in the index, the files on disk are left unchanged
--pathspec-from-file <File>Pathspec is passed in <file> instead of commandline args. If <file> is exactly - then standard input is used. Pathspec elements are separated by LF or CR/LF. Pathspec elements can be quoted as explained for the configuration variable core.quotePath (see git-config[1]). See also --pathspec-file-nul and global --literal-pathspecs
--pathspec-file-nulOnly meaningful with --pathspec-from-file. Pathspec elements are separated with NUL character and all other characters are taken literally (including newlines and quotes)
--This option can be used to separate command-line options from the list of files