Git Learning (II) Git basis

Git basis

Git in time to save and treat a variety of information and there are other version control systems such as SVN, and so very different, very similar to the form even though the operation command, understanding those differences will help prevent you from using the confusion.

What is the record Git?

If you have experience with SVN and other version control systems, you should know that they work every change is recorded. Save them information as a set of basic files and each file over time, gradually accumulated difference.
Here Insert Picture Description

The Git has decided the sword easy road, in a "heresy" approach to deal with seemingly version iterations. Git does not treat or save the data in the above manner. Conversely, Git more like a data snapshot as a set of small file system. Every time you submit updates, or save the state of the project in Git, it was mainly to make a snapshot of all files and saves a snapshot of the index.
Here Insert Picture Description
As above, if the file changed in each version, Git will copy the entire file and save it. This design would appear to consume more space, but in the branch management Shique brought a lot of benefits and convenience.

Three states

Git has three states, your file may be in one of them

  1. Has been submitted (committed): Security has been submitted indicates that data was stored in the local database.
  2. Modified (modified): Modified representation changed the file but have not saved to the database.
  3. It has been staging (staged): Staging has expressed a modified version of the current file been marked to include in the next snapshot submitted.

Thereby introducing the concept of three working areas Git project: the work area, staging area and Git repository
Here Insert Picture Description

  1. Work area (Working Directory) is where you normally store the project code.
  2. Staging area (Stage) for temporary storage of your changes, in fact it's just a file, save the file list of information to be submitted.
  3. Git repository (Repository) is a safe storage location of the data, this side has submitted all versions of your data. Which, HEAD points to the latest version into the warehouse (to be exact, it should be pointed Git repository HEAD version).

The basic Git workflow is as follows:

  1. Modify files in the working directory.
  2. Scratch file, the snapshot file into the staging area.
  3. Submit updates, locate the file in the staging area, the snapshot permanently stored in the Git repository directory.

Therefore, three states Git management file corresponding to the order at a time on top of each process. Remember these three work areas, because all operations back to teach Git basically between the three work areas just kept on going!

Guess you like

Origin blog.csdn.net/qq_16830879/article/details/89567417