The Question
What are specific examples of commit-ish and tree-ish in Git?
The Stack Overflow question "What does tree-ish mean in git?" deals with tree-ish specifically, but I want to understand more about both.
Background
Usages in Documentation
The Git documentation makes several references to "commit-ish" and "tree-ish". For example, if you're examining the Git source code:
$ git grep --files-with-matches --extended-regexp "commit(-)*ish"
config.txt
git-describe.txt
git-fast-import.txt
git-name-rev.txt
git-push.txt
git-rebase.txt
git-rev-parse.txt
git.txt
gitcli.txt
glossary-content.txt
howto/revert-branch-rebase.txt
revisions.txt
and
$ git grep --files-with-matches --extended-regexp "tree(-)*ish" | \
$ grep --invert-match RelNotes
diff-format.txt
diff-generate-patch.txt
git-archive.txt
git-cat-file.txt
git-checkout.txt
git-diff-index.txt
git-diff-tree.txt
git-ls-files.txt
git-ls-tree.txt
git-merge-tree.txt
git-read-tree.txt
git-reset.txt
git-svn.txt
git.txt
gitcli.txt
gittutorial-2.txt
glossary-content.txt
revisions.txt
Definitions
The Git documentation defines what "commit-ish" and "tree-ish" are:
<tree>
Indicates a tree object name.
<commit>
Indicates a commit object name.
<tree-ish>
Indicates a tree, commit or tag object name. A command that takes a
<tree-ish>
argument ultimately wants to operate on a<tree>
object but automatically dereferences<commit>
and<tag>
objects that point at a<tree>
.<commit-ish>
Indicates a commit or tag object name. A command that takes a
<commit-ish>
argument ultimately wants to operate on a<commit>
object but automatically dereferences<tag>
objects that point at a<commit>
.
The Documentation isn't Clear Enough
Even though the documentation above defines what "commit-ish" and "tree-ish" are, I still find it to be too vague and unclear.
What are specific examples of "commit-ish" and "tree-ish", and how are they different from each other?
man gitglossary
in your CLI