title: git: cleanup or delete commit to cleanup the commit history
body: <p>The docs and searching is just confusing me about what to do to cleanup a commit history. </p>
  
  <p>Say I have a branch called tests that I use to push builds to travis-ci and I have a build failing. I would then have to make some small commits to try to fix the error message and re-push the <code>tests</code> branch. </p>
  
  <p>This could lead to a chain of small and nearly pointless commits that I do not really want to make, but I am forced to nonetheless. How would I compact these into one commit? I think <code>rebase</code> is what I am looking for but I am confused about a few things. </p>
  
  <p>If I use <code>squash</code>, I find that I run into a ton of merge conflicts that I have to then go and solve manually. </p>
  
  <p>I think the solution may be to just delete the commits, but then I am not sure if I will be deleting some history that my final "working" commit needs.</p>
  
  <p>Say my commit history looks like this:</p>
  
  <pre><code>commit1: some new feature
  commit2: crap, builds failing, trying fix
  commit3: more build attempts
  commit4: Ahh I think I got it this time
  commit5: ok finally fixed, build passing
  </code></pre>
  
  <p>Now I would essentially like to have only one commit to merge back into the <code>master</code>. What would you do here that isn't going to lead to merge conflicts?</p>