title: Find all dependency commits in Git
body: <h1>Intro</h1>
  
  <p>I am using Git to control hotfixes delivered to production.</p>
  
  <p>When Development team want to deliver some change to production, they create a bundle of files, called a hotfix, and send to Production team. A hotfix is indicated by its ID such as <code>HF1, HF2, ..., HF6</code>.</p>
  
  <p>Production team is in charge of reviewing each hotfix and confirm them to deploy on production, we are trying to use git to track the status these hotfixes, suppose our git history was like</p>
  
  <pre><code>O-HF1-HF2-HF3 (production)
             \-HF4-HF5-HF6-HF7-HF8-HF9 (delivery)
  </code></pre>
  
  <p>where <code>production</code> branch has all hotfixes that have been confirmed to production and <code>delivery</code> branch has the rest of hotfixes delivered by development team but not confirmed to production.</p>
  
  <p>Now suppose that HF8 has a change delivered as <code>SomeJavaClass.class</code> and we have an urgent need to deploy this hotfix to production while we have not yet finish reviewing HF4 - HF7. We would do as follows</p>
  
  <ol>
  <li><p>using <code>git rebase -i HF3</code> and reorder the delivery branch so that HF8 become the first item next to HF3</p></li>
  <li><p>usually this will end up with a conflict because there will be some files in HF4 - HF7 that have changes to which HF8 depens. We have to find all such hotfixes and rebase them together. For exameple, suppose HF5 and HF7 also have change in <code>SomeJavaClass.class</code> and therefore are dependencies of HF8, we would rebase the history to </p>
  
  <pre><code>O-HF1-HF2-HF3 (production)
             \-HF5-HF7-HF8-HF4-HF6-HF9 (delivery)
  </code></pre></li>
  <li><p>merge <code>production</code> branch to HF8</p>
  
  <pre><code>O-HF1-HF2-HF3-HF5-HF7-HF8 (production)
                         \-HF4-HF6-HF9 (delivery)
  </code></pre></li>
  </ol>
  
  <h1>The question</h1>
  
  <p><strong>Is there a git command that help me find all hotfixes between HF4 - HF7 that is a dependency of HF8 before doing the rebase?</strong></p>
  
  <p>Note: My purpose is to develop a shell script that, given HFX as the input, do the rebase and merge HFX and all of its dependency hotfixes in <code>delivery</code> branch to <code>production</code> branch.</p>