git 备查

---------------------机器配置-----------------------
每台电脑一次就行
生成密钥

ssh-keygen

生成后添加到网站https://gitee.com/profile/sshkeys页面

用户信息全局配置

git config --global user.email "***@**.com"
git config --global user.name "congxinglong"

HTTPS连接项目时, 关闭证书告警

git config --global http.sslverify false

-------------------项目内部----------------
进入项目文件夹后
初始化 git 仓库

git init

或者克隆项目

git clone 项目地址

为文件夹添加路由

git remote add 项目名 项目地址

例子:

git remote add MachineLearning git@gitee.com:congxinglong/********.git

查看路由

git remote -v

移除路由

git remote remove 项目名

拉取(变基)

git pull --rebase 项目名 分支名

提交代码
git add .
填写注释

git commit -m "**********"

推送代码

git push 项目名 分支名

版本回滚
进入目录 .git/logs/refs/heads
打开对应分支文件
根据对应的提交号回滚本地文件

git reset --hard ****************
原文地址:https://www.cnblogs.com/congxinglong/p/15042932.html