GIT – How To Add Files To Stagging Area?


How To Add Files To Stagging Area?

Table Of Contents:

  1. What Is A Staging Area?
  2. Adding Files To Staging Area?
  3. Examples Of Adding Files.

(1) What Is A Staging Area ?

  • A stage is something where people come for an audition, or performance being judged by the judges and gets selected.
  • Likewise in ‘GIT’ , a staging area is something where you put your files for GIT to track, and you review what are the changes you have done.
  • After you finalize the files, then you can commit them to the ‘git’ repository.

(2) Adding Files To The Staging Area.

  • You can add single or multiple files to the staging area by using the below command.

Adding Single File

git add <FileName>

Adding All The File

git add -A

Or

git add .

(3) Examples Of Adding Files To Staging Area

  • I have two files in my local repository,  that I want to add to the staging area.
  • First check the status of those files, whether it’s being added or not.
  • These files are not being added to the staging area, hence it is showing in red colour.

Adding Single File

git add File1.txt
  • These files is being added, hence it is in Blue color.

Adding All File

git add .

Leave a Reply

Your email address will not be published. Required fields are marked *