1. 对比两个 COMMIT

git diff <commit> <commit>

2. 对比 COMMIT 和父 COMMIT

git diff <commit^>git diff-tree -p <commit>

3. 只显示某一个 commit 修改过的文件名称

git diff-tree --no-commit-id --name-only -r <commit>

示例:

$ git diff-tree --no-commit-id --name-only -r HEAD

src/packer/GitMessenger.java
src/packer/PackerModule.java

4. 签出单个文件

git checkout <branch> path/to/the/file
git checkout <commit> path/to/the/file

相关文章:

  • 2021-04-15
  • 2021-10-19
  • 2021-12-07
  • 2022-12-23
  • 2022-12-23
  • 2021-12-25
猜你喜欢
  • 2022-12-23
  • 2021-09-15
  • 2022-12-23
  • 2021-08-04
  • 2021-10-26
相关资源
相似解决方案