git

62 阅读1分钟

版本管理的历史

1.cvs

2.svn

3.git

cvs和svn属于集中式版本管理,所有提交等信息都是存在服务器端,本地没有存信息(安全隐患比较大)

image.png

git是属于分布式版本管理,代码分支信息本地远程都有存

image.png

git配置项

配置用户信息

image.png

检测当前的配置信息列表 git config --list

image.png

git别名

image.png

git文件状态分类

image.png

git常用命令

git init:初始化本地仓库

git clone url:克隆远程仓库

git status:查看文件状态(git status -s:更简洁的文件状态)

git add .:将修改或未跟踪的文件放在暂存区

git commit -m "提交信息":提交信息

git查看提交历史

git log:查看提交的历史

image.png

git log --pretty=online:简单一行展示提交信息历史

image.png

git log --pretty=online --graph

image.png

查看被回退的版本git reflog

可以利用这个再返回被退回之前版本 image.png

git版本回退

image.png

远程仓库验证

http凭证存储、ssh的密钥

http凭证存储

image.png

ssh密钥

ssh公钥是拿来跟远程配对的

image.png

查看分支删除分支

image.png

git 命令表

image.png