I’m trying to see files which they were committed in a certain commit via git ls-tree but instead of that it shows my whole directory, I tested that in multiple commits and the result is the same.
expected result:
$ git ls-tree head
100644 blob ce4cd2cb0786a5bced850f90dfcbff89db7d04d3 lome.txt
output:
$ git ls-tree head
100644 blob aa491f5e3957ba167426557bc64c49bb5d585b38 a.js
040000 tree 340c695e5566ac5d2b0d52e49a88be2aa3d2de7b hello
100644 blob ce4cd2cb0786a5bced850f90dfcbff89db7d04d3 lome.txt
100644 blob 55b22fd33cc353103412c20b6ad99fb19bed3cfb lome11.txt
100644 blob 08da3212bb2f49a2bd6774567fd2ae483940e2bc lome111.txt
100644 blob e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 lome1111
100644 blob 178de085c0f8c798eae5dedc9e83145f852adb80 lome44.txt
100644 blob ba9d715a5b4d262a2432ec436f8f6020a29eb017 lome444.txt
100644 blob 40b3181807db07827b87a1c2086faaed15c4a953 lome5.ttx
100644 blob 461c13392c462c1d743dada3acc66a90cd9a25b7 lome5.txt
100644 blob 300220e0ceea89d36cebc852428890a28c45e701 lome7.txt
040000 tree 494990e9780f9a79526285c0321280e3f407fae5 new
>Solution :
You have not understood what a commit is (and therefore, what Git is), and thus your expectations are wrong. A commit is a snapshot of all the files in your project, regardless of whether a particular file has changed since the previous commit. Every commit contains all the files.