[Git] Git 经常使用技巧

版本对比

1. 对比两个 COMMIT

git diff <commit> <commit>java

2. 对比 COMMIT 和父 COMMIT

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

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

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

示例:code

$ 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
相关文章
相关标签/搜索