• git status 查看变更
  • git status -s 查看变更简单模式
  • git status --ignored 展示忽略的文件
  • git log 查看日志
  • git log --oneline 单行查看日志
  • git log --stat 显示详细commit历史
  • git reflog 显示当前分支的最近几次提交
  • git log <-number> [--pretty] [--oneline] 显示过去几次提交
  • git log --follow [file] 显示文件版本历史
  • git blame [file] 显示指定文件是什么人在什么时间修改过
  • git show [--name-only] <commit-id> 显示commit内容变化
  • git show [commit-id]:[file] 显示某次提交时,某个文件的内容
  • git log --grep <keyword> 过滤&搜索
  • git log --author <author-name> 指定作者查询
  • git log --after='<date>' --until='<date>' 通过日期查找
    git log --oneline --after="2019-02-20" --until='2020-02-20'
    
  • git grep <keyword> [branch-name|tag-name] 搜索
    git grep "Hello"
    git grep "Hello" v2.5
    
  • git diff 显示暂存区和工作区的差异
  • git log -p [file] 显示指定文件相关的每一次diff
  • git diff --cached [file] 显示暂存区和上一个commit的差异
  • git diff [first-branch] [second-branch] 显示两次提交之间的差异
  • git diff HEAD 显示工作区与当前分支最新commit之间的差异
  • git shortlog -sn 显示所有提交过的用户,按提交次数排序
  • git diff --shortstat "@{0 day ago}" 显示今天你写了多少行代码
  • git log --graph --decorate --oneline 绘制分支图