1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
| # 显示有变更的⽂件 $ git status # 显示当前分⽀的版本历史 $ git log # 显示commit历史,以及每次commit发⽣变更的⽂件 $ git log --stat # 搜索提交历史,根据关键词 $ git log -S [keyword] # 显示某个commit之后的所有变动,每个commit占据⼀⾏ $ git log [tag] HEAD --pretty=format:%s # 显示某个commit之后的所有变动,其"提交说明"必须符合搜索条件 $ git log [tag] HEAD --grep feature # 显示某个⽂件的版本历史,包括⽂件改名 $ git log --follow [file] $ git whatchanged [file] # 显示指定⽂件相关的每⼀次diff $ git log -p [file] # 显示过去5次提交 $ git log -5 --pretty --oneline # 显示所有提交过的⽤户,按提交次数排序 $ git shortlog -sn # 显示指定⽂件是什么⼈在什么时间修改过 $ git blame [file] # 显示暂存区和⼯作区的差异 $ git diff # 显示暂存区和上⼀个commit的差异 $ git diff --cached [file] # 显示⼯作区与当前分⽀最新commit之间的差异 $ git diff HEAD # 显示两次提交之间的差异 $ git diff [first-branch]...[second-branch] # 显示今天你写了多少⾏代码 $ git diff --shortstat "@{0 day ago}" # 显示某次提交的元数据和内容变化 $ git show [commit] # 显示某次提交发⽣变化的⽂件 $ git show --name-only [commit] # 显示某次提交时,某个⽂件的内容 $ git show [commit]:[filename] # 显示当前分⽀的最近⼏次提交 $ git reflog
|