Git theoretical basis

Full text excerpted from: https: //www.cnblogs.com/best/p/7474442.html# comments!

Thanks to the original bloggers


 

1, the work area

Local Git has three work areas: working directory (Working Directory), the staging area (Stage / Index), resource library (Repository or Git Directory). If you add a remote git repository (Remote Directory) can be divided into four work areas. File conversion relationship between these four areas as follows:

  • Workspace: the workspace , it is where you usually store the project code
  • Index / Stage: temporary storage area for temporary storage of your changes, in fact it's just a file, save the file to the list of information to be submitted
  • Repository: warehouse district (or local warehouse) , where the data is secure, and there are you committed to all versions of the data. HEAD which points to the latest version into the warehouse
  • Remote: remote repository , managed code server, you can simply considered the project team in a computer for remote data exchange

The three local area precisely, it should be pointed git repository HEAD version

  • Directory: Use a Git directory management, which is a warehouse that contains our work space and Git management space.
  • WorkSpace: the need for directory and file version control via Git, these directories and files in the workspace.
  • .git: Git storage directory management information, initialization is automatically created when the warehouse.
  • Index / Stage: staging area, or call the update area to be submitted, before submitting to enter repo, we can put all the updates in the staging area.
  • Local Repo: local warehouse, stored in a local repository; HEAD will be just the current development branch (branch).
  • Stash: hidden, it is a working state saving stack used to save / restore temporary state of WorkSpace.

2, workflow

git workflow is generally like this:

1, in the working directory to add, modify files;

2、将需要进行版本管理的文件放入暂存区域;

3、将暂存区域的文件提交到git仓库。

因此,git管理的文件有三种状态:已修改(modified),已暂存(staged),已提交(committed)

3、图解教程

个人认为Git的原理相比别的版本控制器还是复杂一些的,有一份图解教程比较直观:

图解教程英文原版

图解教程中文版

 

Guess you like

Origin www.cnblogs.com/utank/p/12180064.html