Can I checkout a tree object in git?
git
Solution
If this happens often, or if you will need to switch back and forth from other commits, you can create a new commit object that points to this tree, and then create a new branch that points to it for convenience:
git commit-tree <<treeid>>
<<type a commit message>>
^D
<<this will produce a hash for the new commit object>>
git branch newbranch <<newcommithash>>
Then you should be able to just `git checkout newbranch` whenever you need to...
Problem
I have lost the commit object in a corrupt repository, but there are still some files and the tree object: ``` $ git fsck Checking object directories: 100% (256/256), done. dangling blob 031be26142ed97da216fb7d79d16a0b0efdf0d71 dangling blob 4b2be7dfef082c2e247be52e6d78600af7b6dd40 dangling tree 4b825dc642cb6eb9a060e54bf8d69288fbee4904 dangling blob ccbb1056cb4e744f9a4b44a439fa036f6a3d7cbe dangling blob 10bfbc3c1fa10e08cd6a783565f00e7324f61fe5 dangling blob 9b529957be714fef304c4e8161fe6cd138510e98 dangling blob dd5b54882d0b74db99c8a7fbba703d528dc559b9 ``` Is there a way to check out that tree object? I guess there could be a way to rebuild the commit object with a dummy commit string and check that out. ``` git cat-file -p tree-sha1 ```