In this tutorial you will learn how to use Git ls-tree command and tree-ish ids.
Code used during this tutorial:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# Git ls-tree command # Lists the contents of a given tree object, like what "/bin/ls -a" does in the current working directory # git ls-tree works with tree-ish ids # "Tree-ish" is a term that refers to any identifier that ultimately leads to a (sub)directory tree git log git ls-tree HEAD git ls-tree master git ls-tree 9046780b0d104ed8 # Path # List css dir git ls-tree HEAD css # Lists content inside css/ dir git ls-tree HEAD css/ # Useful options # -r Recurse into sub-trees git ls-tree -r HEAD # -t Show tree entries even when going to recurse them git ls-tree -rt HEAD # -l Show object size of blob (file) entries git ls-tree HEAD -l git ls-tree HEAD -rl # Back one commit git ls-tree -r HEAD^ # Back two commits git ls-tree -r HEAD^^ # Back two commits git ls-tree -r HEAD~2 # Man page man git-ls-tree |