git log --grep "xxx"僅搜索提交日志,而git log -- *_test.cpp僅顯示提交僅包含 *_test.cpp。
有沒有辦法顯示包含檔案名(*_test.cpp)的提交?我想計算 commit1、commit2 和 commit3 的情況。
commit1:
/path_a/file_a.cpp;
/path_a/file_b.cpp;
/path_b/file_a_test.cpp;
commit2: /path_c/file_b_test.cpp
commit3: /path_d/file_d_test.cpp
/path_e/file_e_test.cpp
謝謝。
uj5u.com熱心網友回復:
我認為使用**通配符會讓你得到你想要的:
git log '**/*_test.cpp'
**匹配任意數量的目錄。有關更多詳細資訊,請參閱檔案。
uj5u.com熱心網友回復:
你的標題說計數,你的問題正文說顯示。
數數:
git rev-list --count @ -- \*_test.cpp
串列:
git rev-list @ -- \*_test.cpp
展示:
git log @ -- \*_test.cpp
我建議添加--no-merges或--first-parent避免重復列出轉發更改的每個合并以及進行更改的提交。
git log -- *_test.cpp只顯示提交只包含*_test.cpp
這不是我的git log作業方式,也不是記錄它的作業方式。檢查你的證據,我認為你誤解了導致你這么說的任何東西,例如,在我的 git repo 中:
$ git log -10 --pretty=format: --name-only --no-merges @ -- \*-*.c
refs/files-backend.c
builtin/cat-file.c
builtin/cat-file.c
fmt-merge-msg.c
t/helper/test-drop-caches.c
stable-qsort.c
builtin/update-index.c
read-cache.c
builtin/receive-pack.c
builtin/cat-file.c
builtin/rev-list.c
ref-filter.c
$
但是添加該--full-diff選項會提供更長的這些提交所涉及的檔案串列。
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/419586.html
標籤:
