title: git: list all commits made on a branch (--first-parent gives wrong result)
body: <p>I am trying to list all commits made on a branch in git and suspect that this is impossible to do. Am I right?</p>
  
  <p>Given the following git history:</p>
  
  <pre><code>A - B - D  master branch 
    \ C /    dev branch
  </code></pre>
  
  <p>The order of commits:</p>
  
  <ol>
  <li>A, initial commit made on master</li>
  <li>C, made on dev branch</li>
  <li>B, made on master branch</li>
  <li>D, merge commit, when merging master into dev</li>
  <li>D, merge commit, when merging dev into master</li>
  </ol>
  
  <p>When step 5 happens, the master branch tag is moved from B to D.</p>
  
  <p>After step 4, the first parent of D is C. But since the merge in step 5 does not create a new merge commit, only the branch tag is moved, after step 5, the first parent of D is still C.</p>
  
  <p>So when running</p>
  
  <pre><code>git log --first-parent master
  </code></pre>
  
  <p>to see the history of master branch, it will list the commits D, C, A. Which is wrong, because C was created on dev branch, not on master.</p>
  
  <p>I am aware that git does not store information which branch was used when a commit was created. It also seems that it is impossible to find out this information from the git history. Does this mean that basically there is <em>no way</em> to tell the list of commits made on a branch in git? In this case I would like to see the result D, B, A.</p>