[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
相關文章
相關標籤/搜索