Git learning basic commands (a)

Initialize the local git repository: git init
 
Signature settings: git config user.name XXX
git config user.email XXX
The top two levels of the warehouse, you can view the config settings under .git see signature
The following is a system-level users can hide files in ~ to see the .gitconfig
git config --global user.name XXX
git config --global user.email XXX
 
View status: git status
 
Adding to the staging area: git add filename
 
Submitted to the local library: git commit filename
 
 
Version history: git reflog, git log, git log --pretty = oneline
 
Version rollback forward: git reset --hard local index value (based on the index value)
git reset --hard ^ (exclusive OR symbol, a symbol XOR back a version, only backward, not forward)
git reset --hard ~ n (tilde used, n being a few to a few steps back, only backward, not forward)
 
The reset command comparison of three parameters: - soft (HEAD pointer moves only in the local library)
--mixed (HEAD pointer moves in the local library and resets temporary storage area)
--hard (HEAD pointer moves in the local library and resets the work area and temporary)
 
Recover deleted files:
Prerequisite: Before deleting status of the file is submitted to the local library
Back: git reset --hard [position of the pointer]
If the operation to delete submitted to the local library, then the pointer is history
If you delete operations are added to the staging area not submitted to the local library, the position of the pointer is HEAD
 
Diff file:
工作区中的文件和暂存区文件进行比较:
git diff 文件名
如果工作区中的文件和本地库中文件进行比较的话:
git diff 版本号 文件名

Guess you like

Origin www.cnblogs.com/lgxblog/p/11119954.html