Book Image

Git Version Control Cookbook

By : Aske Olsson, Rasmus Voss
Book Image

Git Version Control Cookbook

By: Aske Olsson, Rasmus Voss

Overview of this book

Table of Contents (19 chapters)
Git Version Control Cookbook
About the Authors
About the Reviewers

Displaying the file information

While 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.

Getting ready

Again, we'll use the data-model repository from the previous example.

How to do it...

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

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.....