原文来源:https://stackoverflow.com/questions/3338126/how-do-i-diff-the-same-file-between-two-different-commits-on-the-same-branch

在git中,我该如何比较同一分支上的不同commit之间的差异?

查看git-diff的帮助页面:

git diff [--options] <commit> <commit> [--] [<path>...]

例如,现在我想看main.c文件,现在和两个commit之前的版本的区别,有下面三种同等的写法:

$ git diff HEAD^^ HEAD main.c
$ git diff HEAD^^..HEAD -- main.c
$ git diff HEAD~2 HEAD -- main.c

相关文章:

  • 2022-12-23
  • 2021-09-16
  • 2022-12-23
  • 2022-12-23
  • 2021-09-16
  • 2021-11-22
  • 2021-08-01
  • 2021-11-06
猜你喜欢
  • 2022-12-23
  • 2022-02-05
  • 2022-12-23
  • 2022-12-23
  • 2022-02-04
  • 2021-08-11
  • 2022-12-23
相关资源
相似解决方案