Git command `add`
Definition
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.
Basic usage
Add file content to index if file is untracked or changes in file to index if file is tracked
$ git add <file>
Add multiple files content and/or changes in files to index, depending on tracking status
$ git add <file_1> <file_2> <file_3> ...
Advanced usage
Add file content / changes in file content to index or remove file from tracking list if file doesn’t exist anymore in working directory
$ git add -A <file>
Add parts of changes in file content to index. Parts are selected interactively within hunks of changes generated by git
$ git add -p <file>
Expert usage
Add (edited) parts of changes in file content to index. Parts are selected/modified interactively from a diff between index and current version
$ git add -e <file>