git ls-tree can give information about tree objects in the repository, it can't be used to display information about the index and working area. The
git ls-files command can do this, and we will explore this next.
For specific file information, we can use the
ls-files command to get information about files in the working tree and the staging area. By default,
git ls-files will show the files in the staging area, as shown in the following command:
$ git ls-files README.md a_sub_directory/readme another-file.txt cat-me.txt hello_world.c
Note this includes all files in the staging area (the tree state at the latest commit,
HEAD) and files added since. The
status command shows the changes between
HEAD and staging area and the staging area and working tree. We can try to create a new file and see what happens using the following command:
$ echo 'Just testing.....