ARTICLE DETAIL

资讯详情

深耕网站建设与运营推广的一线实战洞察。

linux之git

linux之git

1. 下载git

sudo apt install git

2. 初始化仓库

在要初始化的地方

git init

可能出的错 fatal: detected dubious ownership in repository at

解决方法(不是我写的):解决Git报错:fatal: detected dubious ownership in repository at-CSDN博客

3. 暂存

git add .

4. 提交

git commit -m “xxxxxxx”

第一次提交可能遇到的错误 Please tell me who you are.

解决方法(不是我写的):解决git上传提交的时出现:Please tell me who you are.问题_*** please tell me who you are.-CSDN博客

5. 连接远程仓库

git remote add origin xxxxxxxxxx

6. 拉取远程仓库

git pull origin master

6. 提交

git push -u origin "master"

6. 查看状态

git status

7. 差异对比

git diff

8. 查看版本信息

git log

简化查看

git log --pretty=online

9. 版本回退

//回退到上一次
git reset --hard HEAD^

HEAD^^ 上两次,最多12个版本

10. 取消回退

1) git reflog 查看HEAD前面的版本号

2)git reset --hard 版本号

提交前要暂存,按顺序

返回列表