使用文件过滤器时,Git show不会显示所有提交

时间:2019-10-18 14:25:05

标签: git

在命令-- *.ps1后面使用选项git show 8b8aab476011f97a2885607fc6e872ec72e5a912..HEAD --name-only -m --pretty=oneline时,我没有得到我期望的所有提交。

当我输入以下命令时(没有过滤器)

git show 8b8aab476011f97a2885607fc6e872ec72e5a912..HEAD --name-only -m --pretty=oneline

结果:

b11dc7a851805de2b938eb7728775cdf3b289980 (from bef83b7bf4631b99352e910e737e70dabf6e9f7e) (HEAD -> master, origin/master) Merged PR 336: mergeo ti master**
_cicd/GetRevisions.ps1
applicationinsights/azuredeploy.json
asc/azuredeploy.json
3e95c56d8ebdafebc505a77cfa82823fe8dac625 (origin/develop, origin/HEAD, develop) Merged PR 335: asc to 3.1.1.0
asc/azuredeploy.json
7e3cee91802e825fab67bc0543940de89f801399 Merged PR 334: ain to 1.4.1.0
_cicd/GetRevisions.ps1
applicationinsights/azuredeploy.json
bef83b7bf4631b99352e910e737e70dabf6e9f7e (from c7f7d091641fd087db7d495ecd6ffc3d3276d195) Merged PR 333: to master aco
_cicd/GetRevisions.ps1
apiconnection/azuredeploy.json
b15d05d5e4cbe3c3471373299c0feb42a5bd5724 (from 7d1a89144110b6614aa2d8e9593915e1a72698a2) Merged PR 332: vv
_cicd/GetRevisions.ps1
apiconnection/azuredeploy.json
ce28d9802df96d1e8aab6cf843a394e363afcee9 vv
_cicd/GetRevisions.ps1
apiconnection/azuredeploy.json
c7f7d091641fd087db7d495ecd6ffc3d3276d195 (from 8b8aab476011f97a2885607fc6e872ec72e5a912) Merged PR 331: to master
_cicd/GetRevisions.ps1
apiconnection/azuredeploy.json
7d1a89144110b6614aa2d8e9593915e1a72698a2 (from 4572605c065a05cda35b738e9a34ef86b1bbffca) Merged PR 330: upd
_cicd/GetRevisions.ps1
apiconnection/azuredeploy.json
a48fe4a3e63c8de14c82b4c067f627ddfc20a809 upd
_cicd/GetRevisions.ps1
apiconnection/azuredeploy.json

与过滤器一起使用时 git show 8b8aab476011f97a2885607fc6e872ec72e5a912..HEAD --name-only -m --pretty=oneline -- *.ps1

结果:

7e3cee91802e825fab67bc0543940de89f801399 Merged PR 334: ain to 1.4.1.0
_cicd/GetRevisions.ps1
ce28d9802df96d1e8aab6cf843a394e363afcee9 vv
_cicd/GetRevisions.ps1
a48fe4a3e63c8de14c82b4c067f627ddfc20a809 upd
_cicd/GetRevisions.ps1

在第一个列表中提到(来自[hashid] ....)的每个地方,使用过滤器时都不会出现在列表中。

例如,我还希望出现以下行:

bef83b7bf4631b99352e910e737e70dabf6e9f7e (from c7f7d091641fd087db7d495ecd6ffc3d3276d195) Merged PR 333: to master aco
_cicd/GetRevisions.ps1
apiconnection/azuredeploy.json

我希望我的git知识有所欠缺,但是经过大量搜索我还是无法弄清楚。

1 个答案:

答案 0 :(得分:0)

我找到了this answer。这使我尝试将--follow添加到我的命令中,这给了我想要的结果。这样完整的命令将变为:

git show 8b8aab476011f97a2885607fc6e872ec72e5a912..HEAD --name-only -m --follow --pretty=oneline -- *.ps1

结果:

b11dc7a851805de2b938eb7728775cdf3b289980 (from bef83b7bf4631b99352e910e737e70dabf6e9f7e) (HEAD -> master, origin/master) Merged PR 336: mergeo ti master
_cicd/GetRevisions.ps1
7e3cee91802e825fab67bc0543940de89f801399 Merged PR 334: ain to 1.4.1.0
_cicd/GetRevisions.ps1
bef83b7bf4631b99352e910e737e70dabf6e9f7e (from c7f7d091641fd087db7d495ecd6ffc3d3276d195) Merged PR 333: to master aco
_cicd/GetRevisions.ps1
b15d05d5e4cbe3c3471373299c0feb42a5bd5724 (from 7d1a89144110b6614aa2d8e9593915e1a72698a2) Merged PR 332: vv
_cicd/GetRevisions.ps1
ce28d9802df96d1e8aab6cf843a394e363afcee9 vv
_cicd/GetRevisions.ps1
c7f7d091641fd087db7d495ecd6ffc3d3276d195 (from 8b8aab476011f97a2885607fc6e872ec72e5a912) Merged PR 331: to master
_cicd/GetRevisions.ps1
7d1a89144110b6614aa2d8e9593915e1a72698a2 (from 4572605c065a05cda35b738e9a34ef86b1bbffca) Merged PR 330: upd
_cicd/GetRevisions.ps1
a48fe4a3e63c8de14c82b4c067f627ddfc20a809 upd
_cicd/GetRevisions.ps1