Git and GitHub
Utility (Software)Jan 10, 2018
Tutorial about the versioning software Git and its three states
How it works
Git does not consider the data.
Git considers its data more like a series of snapshots (snapshot) of a mini filesystem. Whenever committ, or save the state of your project in Git, it basically makes an image of all the files in that moment, saving a reference to the snapshot. To be efficient, if some files have not changed, Git does not resave them, but simply creates a link to the already saved the previous file
The three states
The first thing to always remember of Git is that your file in Git can be in three states: committed (commit), modified (changed) and staged (in stages).
Committated means that the file is safe in the local database.
Modified means that the file has been changed, but has not yet been committed to the database.
In Stage means that you've marked a file, modified in the current version, order to be included in the snapshot at the next commit.
This brings us to the three main sections of a Git project: 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 checkout of a specific version of the project.
These files are extracted from the compressed database in the Git directory, and saved to disk to be used or modified.
The staging area is a file, generally contained in your Git directory, with all the information regarding your next commit. It is sometimes also referred to as 'index', but the standard is to define it as a 'staging area' (rest area).
The basic workflow in Git works like this:
- Edit the files in your working directory
- Make it the stage, adding snapshots to the internship
- Committ, or save files to the internship in a snapshot (snapshot) permanently to your Git directory.