$ git init 创建仓库
$ git add 文件名 把文件添加到仓库
$ git commit -m"解释" 把文件提交到仓库
$ git status 查看仓库当前状态
$ git diff 文件名 查看文件做了哪些修改
$ git log 查看历史记录(--pretty=oneline)(--graph --pretty=oneline --abbrev-commit 图的形式查看)
$ git reset 回退版本(HEAD <file>)(--hard 命令历史)
$ git reflog 查看命令历史
$ git rm 文件名 删除文件
$ git clone 地址 从远程仓库克隆
$git clone -b 分支名 地址 从远程分支克隆
$ git checkout 分支名 切换到该分支
$ git checkout -b 分支名 创建分支并切换到该分支
$ git checkout --file 丢弃工作区的修改
$ git branch 查看所有分支,当前分支前面有个*号
$ git branch 分支名 创建分支
$ git branch -d 分支名 删除该分支
$ git merge 分支名 合并指定分支到当前分支(若冲突,手动解决冲突文件后 git add 冲突文件 ,然后git commit -m"conflict fixed")
$ git remote add 地址 把本地仓库和远程仓库关联起来
$ git push origin master 把本地的commit(提交)push到远程服务器上
$ git push sae master:数字 推送代码到远程仓库版本(数字)
$ git pull origin master 从远程服务器pull新的改动
$ git config --global user.name"用户名" 配置用户名
$ git config --global user.email"邮箱" 配置邮箱
$ git config --list 查看配置列表
$ git stash 保存工作现场
$ git stash list 查看工作现场
$ git stash pop 恢复工作现场
$ git tag 标签名 创建标签
$ git tag 查看标签
$ git tag -d 标签名 删除标签