How do you add changed files from your Git workspace to Staging Area (Index)?
Experience Level:
Junior
Tags:
Git
Source 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
-
What is the most basic Git workflow that you can use every day?
Git Source control Junior -
What is a workspace in Git?
Git Source control Junior -
What is .git folder?
Git Source control Junior -
How do you check what files are changed in your Git workspace?
Git Source control Junior -
What is Staging Area (or Index) in Git?
Git Source control Junior