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

Experience Level: Junior
Tags: GitSource control

Answer

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

Comments

No Comments Yet.
Be the first to tell us what you think.
Git for beginners
Git for beginners

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

Test yourself
25 Git questions that will help you to nail your job interview
25 Git questions that will help you to nail your job interview

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

Test yourself