# 配置
# config
# SSL证书验证
git config --global http.sslverify [ true or false] 关闭(打开)SSL证书验证
# user.name{#name}
git config user.name 查看当前用户名
git config user.name [ name ] 修改当前用户名
# user.email{#email}
git config user.email 查看当前用户邮箱
git config user.email [ email ] 修改当前用户邮箱
# remote
# show
git remote 主机名就是一个代号 列出所有的远程主机名 -v 附带网址
# 重命名远程仓库 {#renameRemote}
git remote rename [ oldName ] [ newName ]
# 添加远程仓库{#addRemote}
git remote add [ remote-name ] [ url ]
# 删除远程主机{#rmRemote}
git remote rm [ remote-name ]
# 初始化
# init
git init or git init [ repoName ] 初始化仓库
# clone
git clone [ url ] 从url中克隆仓库
# 操作
# status
检查暂存库存储情况
# add
git add [ fileName ] .... 将文件添加到暂存区 后面可以加很多文件 *.XXX -> 所有后缀为.XXX的文件
git restore --staged [ fileName ] 取消add
# commit
git commit -m "message" 将暂存区提交到仓库(版本区) -m "XXX" 提交仓库(版本区)时附带信息XXX
git reset [ 记录哈希值 ] HEAD~1表示最后一个
# push
git push [ remote-name ] [ local-branch ] [ remote-branch ] 将本地分支(local-branch)推送到远程仓库(remote-name)的远程分支(remote-branch), 如果输入的是一个没有的分支,那会创建一个新的分支
# pull
git pull [ remote-name ] [ remote-branch ] [ local-branch] 从远程仓库(remote-name)拉取分支(remote-branch)的最新版本,并且跟本地分支(local-branch)合并
# branch
git branch 查看本地分支 -r (remote)查看远程分支 -a (all)查看全部分支,包括本地分支和远程分支 -vv 查看本地分支及其追踪的远程分支
# 删除分支
git branch -d [ branch-name ] 删除本地分支
# 分支追踪
git branch -u [ remote-name ] / [ remote-branch ] [ local-branch ] 将本地分支(local-branch)追踪到远程的(remote-name)分支(remote-branch) 于其等价的是 git branch --set-upstream-to [ ~ ]
# 取消分支追踪
git branch --unset-upstream 取消当前分支的追踪
# checkout
# 分支切换
git checkout [ branch-name ] 切换本地分支到(branch-name)
# 创建分支
git checkout -b [ new-branch-name ] 创建一个新的本地分支
# git checkout [ fileName ]
撤销工作区的更改
# log
git log 查看日志