Git simple operation and principle

Set the signature:

Username: tom
Email Address: [email protected]
git config user.name tom_pro
git config user.email GoodMorning @ atguigu

作用:区分不同开发人员的身份,无其他作用
辨析:这里设置的签名和登录远程库(代码托管中心)的账号、密码没有任何关系
命令:(就近原则:二者都没有不允许)
    项目级别/仓库级别:仅在当前本地库范围内有效
    系统级别:登录当前操作系统的用户范围有效    
    --local / --global / 
查看项目配置保存的位置:cat .git/config

Show log:

log Git
Git = log --pretty oneline
Git log --oneling NOTE: Only the current version of the previous version, the version is not displayed after
git reflog Remarks: HEAD @ {moved to the current version number of steps needed}
multi-screen display mode: blank page down, b page up, q exit

Version forward and back:

Nature: HEAD

Based on the index value of the operation (preferably)

git reset --hard 局部索引值

Use the caret (only back)

git reset --hard HEAD ^ back to a version

git reset --hard HEAD ^^^ backwards three versions

Use tilde

git reset --hard HEAD~3

reset的三个参数对比:
    --soft:
        仅仅在本地库移动HEAD指针
        
    --mixed:
        在本地库移动HEAD指针
        重置暂存区
    --hard:
        在本地库移动HEAD指针
        重置暂存区
        重置工作区

Comparison of file differences:

git diff file name

The workspace file and compares the staging area

git diff local library historical version of a file name

Will compare files and local history library workspace

Branch Management:

Branch benefits:

Branch operation:

View branch: git branche -v

Creating a branch: git branch branch name

Switching branch: git checkout branch name

Merging branches: 1) switched to the main branch git checkout branch names are merged, new content

2) execute the command git merge merge new content branch name

Resolve the conflict:

Git rationale

Snapshot:

Each node has a hash value file

Information stored for each version

Creating equal branches create a pointer

Switching branches: HEAD points to the name of the branch switched

changes in the master branch

Guess you like

Origin www.cnblogs.com/hk-zsg/p/11569783.html