Friday, July 22, 2011

Three states of a file in Git


In my previous post I explained you the main advantages of Git. Here we need to concentrate on the main states that a file will face in Git.

Git has three main states that your files can reside in: committed, modified and staged. Committed means that the data is safely stored in your local database. Modified means that you have changed the file but have not committed it to your database yet. Staged means that you have marked a modified file in its current version to go into your next commit snapshot. This leads us to the three main sections of a Git: the Git directory, the working directory, and the staging area.



The Git directory is where Git stores the metadata and object database for your project. This is the most important part of Git, and it is what is copied when you clone a repository from another computer.

The working directory is a single checkout of one version of the project. These files are pulled out of the compressed database in the Git directory and placed on disk for you to use or modify.

The staging area is a simple file, generally contained in your Git directory, which stores information about what will go into your next commit. It’s sometimes referred to as the index, but it’s becoming standard to refer to it as the staging area.

Thanks

AJAY

No comments:

Post a Comment

Comments with advertisement links will not be published. Thank you.