GIT

Git is a popular, open-source, distributed version control system. A distributed version control system is a foolproof way to keep track of and store project-related files. Git requires having a repository stored on a server and a local repository for each developer which makes it useful to have as a backup in case files accidentally get deleted and need to be reverted. Git is an essential tool in the world of software development. Read more to find out why.

Snapshots

Git stores its data as a series of snapshots which differentiates it from other version control systems. At every commit Git takes a picture of what the files look like and stores a reference to that snapshot. This makes Git very efficient because if the files haven’t changed, Git does not store the file again. In contrast, other version control systems typically store information as multiple sets of files and the changes made to them over time.

States

Files stored with Git are kept track of with three important states. The three states are modified, staged, and committed. A file is considered modified if it has been changed but has not been committed to the database yet. Files can be modified many times until it is marked as staged. The staged state means that the file is ready to go into the next committed snapshot. After the snapshot commit happens and the data in the file gets stored in the database, the file is given a committed state.

Sections

To fully understand states, it is necessary to understand the three main sections of a git project which are the working tree, the staging area, and the Git directory. The working tree is where the checked out version of the project is kept. This is where all edits to the files will be made. Despite its name, the staging area is not actually an area but a file that stores information about what files will be committed next. The staging area is essentially an in-between where ready to go files wait for other files to be edited and marked as staged. Finally there is the Git directory which is where Git stores metadata and all the files in a database for the project.

Workflow

Now that it is understood what states and sections are, it will be easier to understand the workflow of Git. A project first starts by being checked out from the Git directory. This moves a snapshot of the project saved onto the repository into the working tree. Any files that are edited in the working tree get assigned a modified state and then when the user is ready they upgrade the state to staged which adds only those changes to the staging area. When the files are done being modified and staged, the user will perform a commit which takes the files that are in the staging area and stores the snapshot permanently to the Git directory.

Want to Learn More?

This is just a sample of what we can do. We have 15 years of experience working in nearly every technology and industry. Whatever you are doing, we've done it and are prepared to tackle your project. Reach out and we will discuss it with you.