Git add command

The git initcommand is used to add file contents or updates the current content of the working tree to the staging area (so, the staging area contains a snapshot of the working tree data). Every time we add or update any file in our project, it is required to forward updates to the staging area.

The git add command can be run many times before making a commit. These all add operations can be put under one commit.

1. To add one file
git add <file-name>
git add newfile.txt
2. To add more than one file separate file names with space
git add newfile1.txt newfile2.txt
3. Add all the files
To add all the files from the repository, run the add command with -A option. We can use '.' Instead of -A option.
git add -A
git add .

Life cycle of file status in git

Your image is not available