title: GitPython get tree and blob object by sha
body: <p>I'm using GitPython with a bare repository and I'm trying to get specific git object by its SHA. If I used git directly, I would just do this</p>
  
  <pre><code>git ls-tree sha_of_tree
  git show sha_of_blob
  </code></pre>
  
  <p>Since I'm using GitPython and I want to get a specific tree, I do the following:</p>
  
  
  
  <pre class="lang-py prettyprint-override"><code>repo = Repo("path_to_my_repo")
  repo.tree("b466a6098a0287ac568ef0ad783ae2c35d86362b")
  </code></pre>
  
  <p>And get this back</p>
  
  <pre class="lang-py prettyprint-override"><code>&lt;git.Tree "b466a6098a0287ac568ef0ad783ae2c35d86362b"&gt;
  </code></pre>
  
  <p>Now I have a tree object, but I cannot access its attributes like path, name, blobs, etc.</p>
  
  <pre class="lang-py prettyprint-override"><code>repo.tree("b466a6098a0287ac568ef0ad783ae2c35d86362b").path
  </code></pre>
  
  <pre class="lang-none prettyprint-override"><code>Traceback (most recent call last):
  
  File "&lt;stdin&gt;", line 1, in &lt;module&gt;
  File "c:\Python27\lib\site-packages\gitdb\util.py", line 238, in __getattr__
  self._set_cache_(attr)
  File "c:\Python27\lib\site-packages\git\objects\tree.py", line 147, in _set_cache_
  super(Tree, self)._set_cache_(attr)
  File "c:\Python27\lib\site-packages\git\objects\base.py", line 157, in _set_cache_
  raise AttributeError( "path and mode attributes must have been set during %s object creation" % type(self).__name__ )
  AttributeError: path and mode attributes must have been set during Tree object creation
  </code></pre>
  
  <p>But if I type the following, it works</p>
  
  <pre class="lang-py prettyprint-override"><code>repo.tree().trees[0].path
  </code></pre>
  
  <p>The other part of my question is how to get a blob object with GitPython. I noticed that the only object tree has attribute blobs, so in order to get blob by SHA, I have to (a) first know which tree it belongs to, (b) find this blob, and then (c) call the <code>data_stream</code> method.
  I could just do </p>
  
  <pre class="lang-py prettyprint-override"><code>repo.git.execute("git show blob_sha")
  </code></pre>
  
  <p>but I would like to know first that this is the only way to do this. </p>