查看用户名和邮箱
git config user.name
git config user.email
编辑
git config --global user.name
git config --global user.email
初始化仓库 git init
克隆仓库 git clone
查看仓库当前状态,显示有变更文件 git status
添加文件到暂存区 git add . / 文件名
提交暂存区到本地仓库 git commit -m '描述'
上传远程代码并合并 git push
尚未提交的修改保存在堆栈 git stash
查看暂存条目 git stash list
恢复最新暂存 git stash pop
恢复指定暂存 git stash pop stash@{n}
丢弃条目 git stash drop stash@{n}
清楚所有 git stash clear
查看当前stash内容 git show stash@{n}
参考文件
查看本地分支 git branch
查看远程分支 git branch -r
创建分支 git branch (branchname)
切换分支 git checkout (branchname)
合并某分支到当前分支 git merge (branchname)
切换到本地分支并于远程分支关联 git checkout -b 本地 远程
更新远程分支列表 git remote update origin --prune
查看历史提交 git log
回退上个版本 git reset --hard HEAD^
回退到n次提交之前git reset --hard HEAD~n
指定回退到某个版本 git reset --hard id
回退版本后想恢复到新版本 查看已运行命令 获取commit id git reflog