Displaying the tree information

It can sometimes be useful to show or find information on certain trees and files in Git. Here, the ls-tree and diff-tree commands come in handy. Essentially, these are plumbing commands, and they can sometimes be very useful when scripting or browsing.

Getting ready

We'll use the same repository as the previous example:

$ git clone https://github.com/dvaske/data-model.git

We also need a bare repository for some examples; it will by default, with the --bare option, be cloned to data-model.git, so remember which repository you are currently working on:

$ git clone --bare https://github.com/dvaske/data-model.git
$ cd data-model

How to do it...

To show the content of the current tree in the Git context, we can use the ...

Get Git: Mastering Version Control now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.