In an answer to a question about the internal format of git’s tree objects, to get to one particular tree object that was stored in a pack, I unpacked all of the objects in
You can use git pack-objects first to make a pack with only this one object.
Note also that git unpack-objects does not extract objects which already exist in a repository, so you probably want to make a new repository. Overall something like this should work:
$ DIR=$(mktemp -d)
$ echo 5e98806c6cc246acef5f539ae191710a0c06ad3f \
| git pack-objects --stdout \
| ( cd "$DIR" && git init && git unpack-objects )
Then look for your unpacked object in $DIR/.git/objects