title: How do I determine the source branch of a particular branch?
body: <p>I have a branch in git and want to figure out from what branch it originally was branched and at what commit.</p>
  
  <p>Github seems to know, since when you do a pull request it usually automatically sets up what branch it should go into, but I can't figure out how to do this manually from the command line.</p>
  
  <p>Let me add a concrete example:</p>
  
  <pre><code>master -- ongoing development
  2.2    -- stable maintenance
  </code></pre>
  
  <p>A feature branch <code>feature</code> was created (at commit <code>B</code> below) and worked on (<code>B'</code>, <code>C'</code> &amp; <code>E'</code>) and merged against the source branch to pick up <code>C</code> and <code>D</code></p>
  
  <pre><code> feature branch:    B'-C'-C--D--E'
                     /     /       
   source branch: A--B--C--D--E-- ...
  </code></pre>
  
  <p>Now I want to merge <code>feature</code> back into its source, but I am not sure whether it was originally a branch off <code>master</code> or <code>2.2</code>. In order to merge the feature into the correct source, is there a programmatic way to find out if source branch is <code>master</code> or <code>2.2</code>?</p>