Git – tree-ish navigating the commit tree

Git has a concept called as tree-ish it means something that is part of tree or reference to tree. Tree in git means nothing but the structure of commits. These commits contains the information like Sha-1, date, author, comments and changes.

We are able reference our commit by using full or shorten SHA-1 hash, ancestry or HEAD pointer.

for e.g.:- this will point to the tip of the current checkedout branch i.e. HEAD

 git ls-tree HEAD 

This returns list of files at that point. May also use branch name instea of HEAD.

git ls-tree master

Also can see particular dirctory within the branch

 git ls-tree master directoryname

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s