How do you add changed files from your Git workspace to Staging Area (Index)?

Experience Level: Junior
Tags: Git Source control


Before you start adding changes to Staging area (Index), it is good idea to first check what changes you have in your workspace. This can be done by executing the following command from command line:

git status

You can then add changes to Index by using git add command.

The following command adds all changes from the current directory and all its children:

git add .

The following command adds all html files from the folder Views that have some changes:

git add Views\*.html

The following command adds file index.html:

git add index.html

Related Git job interview questions
Git for beginners
Git for beginners

Are you learning Git? Try our test we designed to help you progress faster.

Test yourself