Git使用方法

指令注释
git init 初始化
git config --global user.name "姓名" 配置姓名
git config --global user.email "邮箱" 配置邮箱
git add ./ 添加到待提交
git commit -m "注释" 提交修改
git reset --hard head~0 回退
git reset --hard 版本号 回退到指定版本号
git log 查看日志
git log --oneline 查看精简日志
git reflog 查看以前的所有分支、[版本号]
git branch 分支名 新建分支
git branch 查看分支
git checkout 分支名 切换分支
git merge 分支名 合并分支
git push [地址] 分支名 上传到git服务器
git pull [地址] 分支名 从git服务器下载
git clone [地址] 从git服务器克隆所有,会新建文件夹覆盖
git branch -d 分支名 删除分支
git status 查看当前文件状态
git remote add [变量名] [远程地址] 将远程地址添加到变量
git push/pull -u 分支名 和远程服务器分支关联
ssh-keygen -t rsa -C "邮箱" 生成ssh公钥和私钥

git remote -v    查看所有变量

git remote remove origin  删除指定变量

* 合并分支只会修改当前分支

 

git merge 分支名 --squash   合并代码

 

原文地址:https://www.cnblogs.com/lv77/p/14008142.html