The Git Working Directory, Staging Area, and Repository

On Saturday (2/8/2014), we learned about Git (http://git-scm.com/).  Git is a distributed version control system (http://en.wikipedia.org/wiki/Revision_control).

Git works with three levels of files in the process of modifying one’s files.  These three are:

  1. The Working Directory
  2. The Staging Area, and
  3. The Respository

The Working Directory

This is where you work with your files as you are updating them.  This is on your local machine.

The Staging Area

As you work on your files (and modify them), you will eventually get to a point that you believe you have a version of the file you will want to save in the repository.  In Git, you use the ‘git add’ command to move a particular file into the Staging Area.

Normally, though, you will have a group of files that interact together.  So, you will not want to put individual files into the repository.  Rather, you will want to move the group of files that mean something together, all at once, to the repository.  An example of this would be a program module that has several objects included in the module.

Anyhow, as you ‘git add’ various files, to the Staging Area, you are getting ready to commit the group of files (or the single file, if you have only one) to the repository.

The Repository

The Repository is where all the files for your system (or whatever collection you have) are kept.  When you have your files at a point where you want to save them all you will do a ‘git commit’.  This will move the group of files (all the ones moved to the Staging Area) into the repository.  You will also give a textual label to this update to the repository so you can know what this version was all about!

There are , of course,  many more aspects of the Git system.  This article is only talking about the three levels of working files in the Git system.

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>