git ls-tree(List Git Tree)

GIT ls-tree Command

This command works similar to the ls commands on windows, linux and mac. It takes many parameter the most important being a treeish.
List the tree using the HEAD. Remember, the head points to the last commit on the current branch.
git ls-tree HEAD


List Directory Content

In this example we are listing the content of the src directory.
git ls-tree HEAD src
List the content of the master branch one commit ago(parent commit)
git ls-tree master^ src
Note in the screenshot that that "src" directory itself is a tree while the others are blog. As a result we can reference the src directory by passing the tree has id.
Cookbook Category: 

Add new comment

Plain text

  • No HTML tags allowed.
  • Lines and paragraphs break automatically.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.