[Git] Git 常用技巧

版本对比

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

你可能感兴趣的:(git)