当前位置:   article > 正文

git深入理解(三):git diff详解

git diff

Show changes between commits, commit and working tree, etc

是一个用来查看差异的工具。

查看帮助
$ git diff -h
usage: git diff [<options>] [<commit> [<commit>]] [--] [<path>...]
  • 1
  • 2

信息量过少

比较工作区和暂存区的差别
git diff 
或者
git diff filename
  • 1
  • 2
  • 3
比较暂存区和本库的差别
git diff --cached 
或者
git diff --cached  filename

(Git 1.6.1 及更高版本还允许使用 git diff --staged,效果是相同的)
  • 1
  • 2
  • 3
  • 4
  • 5
比较工作区和版本库的差别
git diff HEAD 
  • 1
比较两个分支上最新的提交
git diff topic master
  • 1
比较上次commit和上上次commit
git diff HEAD^ HEAD
  • 1
比较两个具体commit之间的差异
git diff 818c5faf28d0a0e5c8133dbd77dd24e6e70db9bf 2e1b4bced0f0ce2c20362789be2878b36c6910f7
  • 1
自从某个版本之后都改的了什么
git diff [version tag]

git diff f2b85bf7f7516a6a6a0768e44266d09414b03a2e
  • 1
  • 2
  • 3
比较两个分支
git diff [branchA][branchB]
  • 1
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/煮酒与君饮/article/detail/977000
推荐阅读
相关标签
  

闽ICP备14008679号