Reference book: Git's Definitive guide
Git initialization setting git basic parameters
The file ". Gitconfig" is typically created in the user's home directory to hold settings in a similar configuration file format.
1. Set user name and email address (this information will be displayed at the time of submission)
" KCMETERCEC " "[email protected]"
2. Open color display in git command output
True
3. Git config command description
When only "git config" is used, the "config" file under the current repository ". Git" is configured
When only "git config--global" is used, the ". Gitconfig" file in the home directory of the current user is configured
When using only "git config--system", the "gitconfig" file under "etc" is configured
As with local variables and all variables, the above priority is from high to low.
The format is: git config [--global/--system] [section]. [Key] [Value]
When there is no [value] parameter, the delegate reads, and vice versa, writes.
Version Library
1. Create a version library
Use the Create Repository command to create a ". Git" folder in the current directory, which is a repository for both versions. And the current directory is called the workspace,
Then the work is done under the work area .
In general, it is recommended that you create a good workspace folder before you enter the workspace folder for repository creation.
Git init
2. Find repository and workspace
#显示版本库的位置git Rev-parse--git-dir#显示工作区根目录git rev-parse--show-toplevel# Displays the directory of the current directory relative to the workspace git Rev-parse--show-prefix# shows the depth of the current directory back to the workspace directory git rev-parse--show-cdup
GIT structure GIT basic structure
As shown in GIT basic structure, corresponding to do basic command introduction.
Workspaces: areas where users actually manipulate files
Index: Staging area, which saves the information structure of the user file, is used to modify the file quickly, similar to the inode of the file system
Master: The main branch, which holds the user-submitted file information structure for fast file submission, similar to the file system Inode
HEAD: A branch cursor that indicates that the branch is currently being manipulated
Objects: Object library, which is used to actually store the contents of the file, similar to the file system block
#用于将工作区修改的内容保存到暂存区git Add [file
#清除还没有加入版本库的文件及文件夹
The Git clean-fd# is used to recall the file corresponding to the workspace in the same state as staging area, #也就是相对暂存区新做的修改都会删除git checkout [filerm -- Cached [file] #将工作区以及暂存区的文件都恢复为和HEAD指向的分支一致git checkout HEAD [file]
Directory tree Browsing
1. Browse the workspace directory tree
Use classic "ls" Instructions for easy browsing
2. Browse Staging Area directory tree
ls-tree-l HEAD
3. Browse the Repository directory tree
ls-files-write-ls-tree-l [xxx] #xxx表示由 "git Write-tree" at least the first 4 bits of the ID value of the output
Compare each other
There are the following auxiliary commands to view the difference status of the above 3 regions:
diff diffdiff--cached# view file commit status git status [-S]
Git Object Library
All objects in Git have an ID that represents a unique object with a hash value.
The structure of the entire submission directory and the contents of the user's file can be listed by decoding the contents of the ID at the layer level.
#-p for output ID corresponding to: #-cat-file [-p/-t]
Linux Upper application->git solo