title: How to squash commits after the pull request has been opened?
body: <p>I've looked at all the possible answers on SO and also have read blogs but I think I've messed up pretty bad. </p>
  
  <p>I tried - </p>
  
  <p><code>git rebase -i upstream/master</code> </p>
  
  <p>and then changing <code>pick</code> to <code>squash</code> after the first line, but I was getting merge conflicts again and again. So finally I read an answer on SO which recommended this -</p>
  
  <pre><code>#!/bin/bash
  
  if [ $# -ne 1 ]; then
      echo "Missing parameter: number of commits to squash."
      exit 1
  fi
  
  echo "Squashing $1 commits..."
  git reset --soft HEAD~$1
  git log --format=%B%n --reverse "HEAD@{1}" -n $1 &gt; _msg.txt
  git commit -t _msg.txt
  rm _msg.txt
  echo "Done!"
  </code></pre>
  
  <p>So I tried <code>git-squash 6</code> and I think this messed it up harder. If you need any more information just ask.</p>
  
  <p>Heres the PR - </p>
  
  <p><a href="https://github.com/mushorg/glutton/pull/62" rel="nofollow noreferrer">https://github.com/mushorg/glutton/pull/62</a></p>
  
  <p><a href="https://i.stack.imgur.com/q46ti.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/q46ti.png" alt="enter image description here"></a></p>