title: How to remove unneeded git commits?
body: <p>I have some garbage commits in my git repositry. These have been created by e.g. the git gui when changing the latest commit again and accidently creating additional commits.</p>
  
  <p>Now I have some commits lying around with no HEAD assigned (detached, not part of any branch).</p>
  
  <p>As I want to tidy up, my question is: How can I delete these commits (see F, G and H)? Is this done using rebase or revert or reset? Or using another tool? On which commit do I have to sit to do it?</p>
  
  <pre><code>A -- B -- C -- D -- E [master]
        \-- F -- G
             \-- H
  </code></pre>
  
  <p>Thanks</p>
  
  <p>Christian</p>