Git repository initialization

 

 

 

The warehouse

We can initialize the directory already exists, the contents of the warehouse management
The first step is to create an empty warehouse, which is a prerequisite for subsequent operations

 

[root @ ci-node1 ~] # mkdir -p / the Data / git_test // Create a directory to a git repository 
[root @ ci-node1 ~] # cd / the Data / git_test // enter the directory 
[root @ ci-node1 git_test] # git init // initialize the warehouse to create an empty warehouse using the command git init 
initialized empty Git Repository in /data/git_test/.git/ // after an empty warehouse created under git_test .git folder will generate a hidden folder. This is what we created git repository, the default repository consists of a main branch, that master, the default action is performed on the main branch master. 
[the root @ CI -node1 git_test] # LL - A 
Total 0 
drwxr -XR-X   . 3 the root the root   18 is -Aug 24 00 : . 17 . 
drwxr


 -xr-x. 3 root root  22 Aug 24 00:13 ..
drwxr-xr-x  7 root root 119 Aug 24 00:17 .git

 

Enter git repository

[git_test the root @ CI-node1] # CD .git / 
[the root CI @ - node1 .git] # LL 
Total 12 is 
drwxr -XR X- 2 the root the root    . 6 -Aug 24  00 : . 17 branches // branch 
-rw-r-- r-- . 1 the root the root   92 -Aug 24  00 : . 17 config   // profile 
-rw-R & lt - r-- . 1 the root the root   73 is -Aug 24  00 : . 17 description // profile 
-rw-R & lt - r-- . 1 root root  23 is -Aug 24  00 : . 17 the HEAD   
drwxr -XR X- 2 the root the root 242 -Aug 24  00 : . 17 Hooks // store hook script 
drwxr-X-XR 2 the root the root   21 is -Aug 24  00 : . 17  info 
drwxr -XR-X . 4 the root the root   30 Aug 24-  00 : 17 Objects // warehouse 
drwxr-the X-XR- 4 root root   31 Aug 24-  00:17 refs

 

Git repository base operations

Git four regions

Workspace: Workspace () is to create a git repository (git_test directory) 
Index / Stage / Cached: staging area (it's like a balance area, temporarily save your changes) generally stored in "under .git directory" of the index file (.git / index) in, so we put the staging area is sometimes called the index (index)


Repository: local warehouse district has a hidden directory .git, this is not the work area, but the version of Git
repository.
Remote: a remote repository github gitlab

 

 

Git four states

Speaking in front of the Git has four regions, while the one on file change state level, the files in the Git area also has four states (Note that the file is not a state with Git area one to one), this is the first Git two important concepts.

Untracked: file is not tracked, the new status of the file, the newly created file, Git management were not recorded (not the file cache and warehouses) in the workspace
Modified: state is modified, by Git has managed files changes state (including changes in content, delete files), recorded in the workspace
Staged: after a not trace file, create a new file in the work area, added to the staging area, the state becomes Staged. Recorded in the document workspace change status notification Git, recorded in a temporary area

 

Unmodified: by file status (no change), recorded in a local warehouse / remote warehouse, has not been modified, this document does not make changes to the file on the local Git repository management,

(This file has a copy of these three areas is consistent in the work area, buffer zone, local warehouse, but not modified)

 

Guess you like

Origin www.cnblogs.com/mingerlcm/p/11403311.html