Git add to add files to git

Last updated 2 weeks, 3 days ago | 34 views 75     5

Tags:- Git

Git add | add files to git

This command adds the working directory changes to the staging area. It allows to include the updates to a particular file in the next commit.

Git add doesn't affect the repository until you run git commit.

Git add files

It adds files to the staging area. We can add single or multiple files at once in the staging area.

git add <File name>
git add newfile.txt

Add multiple files together by Wildcard

git add *.java

Git Add All

This command adds all the files at once in the staging area.

git add -A

OR

git add .

Add all New and Updated Files Only

Git allows us to stage only updated and newly created files at once by ignore removal option.

git add --ignore-removal

Add all Modified and Deleted Files

There is another option that is available in Git, which allows us to stage only the modified and deleted files.

git add -u