Workspace:工作区
Index / Stage:暂存区
Repository:仓库区(或本地仓库)
Remote:远程仓库
显示当前git配置
git config --list
提交到暂存区
git add 'code'
姜暂存区代码提交到仓库区
git commit -m'注释' 代码路径
显示所有的本地分支
git branch
所有远程分支
git branch -r
列出所有的远程分支和本地分支
git branch -a
切换分支
git checkout branch_name
查看变更的信息
git status
显示暂存区和本地代码的区别
git diff
显示工作区与当前分支最新commit之间的差异
git diff HEAD
查看提交的代码
git show [commit]
查看提交的文件名
git log --stat
查看当前分支的最近几次提交
git reflog
# 重置暂存区与工作区,与上一次commit保持一致
Index / Stage:暂存区
Repository:仓库区(或本地仓库)
Remote:远程仓库
显示当前git配置
git config --list
提交到暂存区
git add 'code'
姜暂存区代码提交到仓库区
git commit -m'注释' 代码路径
显示所有的本地分支
git branch
所有远程分支
git branch -r
列出所有的远程分支和本地分支
git branch -a
切换分支
git checkout branch_name
查看变更的信息
git status
显示暂存区和本地代码的区别
git diff
显示工作区与当前分支最新commit之间的差异
git diff HEAD
查看提交的代码
git show [commit]
查看提交的文件名
git log --stat
查看当前分支的最近几次提交
git reflog
# 重置暂存区与工作区,与上一次commit保持一致
$ git reset --hard