git diff 两个 commit 之间的 diff 文件

December 10, 2012

操作系统与开发环境

通过 git diff --help 查询 git 帮助文档可看到

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

这个是 diff 两个 commit 之间的内容, 是 commit 的 ID 号,可以通过 git log 查看。获取到两个 commit 的 ID 号后,就可以查看两个 commit 的修改内容了。

git diff commit-id-1 commit-id-2 

或者可以输出到文件里:

git diff commit-id-1 commit-id-2 >> diff.txt

--- EOF ---

评论

  1. 请问下查看本地某个问价和已提交的有什么区别,命令怎么写?

    1. git status 可以看哪些文件被修改了,git diff + 文件名可以看该文件的修改,git diff 不加文件可以看所有文件的修改。

添加新评论