title: How to push history edited with 'git replace' to remote
body: <p>I have a remote with a history that looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/aZvzF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/aZvzF.png" alt="enter image description here"></a></p>
  
  <p>As you can see O and P are merge commits and both of them closed their old branch so now there's only one branch.</p>
  
  <p><strong>I want to squash C-D-E-G-J-K-L-N into one commit and F-H-I-M into an other commit</strong> because they are just tiny commits cluttering the history.</p>
  
  <p>Locally I managed to squash C-D-E-G-J-K-L-N using the method described in <a href="https://stackoverflow.com/questions/14043961/git-squash-history-after-merge">the answer by John O'M. to this question</a>, like this:</p>
  
  <pre><code>git checkout -b squashing-1 N
  git reset --soft C~
  git commit -m "Squashed history"
  git replace N [ID_of_the_commit_i_just_made]
  </code></pre>
  
  <p>and this works, locally <code>git log</code> from main-branch correctly reports Q, P, O, X, M, I, etc. (X is the new squashed commit).</p>
  
  <p>From here the next steps would be to (1) check out the main branch and merge in the changes, (2) delete the temporary local branch, then (3) push the changes to the remote repo. But (1) and (3) report <em>Already up to date</em> or <em>Everything is up to date</em> since there are no actual changes to tree <strong>which is exactly the point of all this</strong>.</p>
  
  <p>I've tried using <code>git push --force origin main-branch</code> and <code>git push --force-with-lease origin main-branch</code> too but i got the same result: <em>Everything is up to date.</em></p>
  
  <hr>
  
  <p><strong>How can I correctly merge in these history changes and push them to BitBucket without having to re-create the entire repo?</strong></p>