Duplicate commits after rebase have been merged into the develop branch
<p>I recently pulled down a remote branch that another developer was working on, let's call it <code>feature</code>. I then made the mistake of doing a rebase onto <code>develop</code> - the main working branch - which I've now come to know is something that you shouldn't do. The <code>feature</code> branch has since been merged into <code>develop</code>.</p>

<p>The problem I have now is that <code>develop</code> has a strange Git history. All of the commits from <code>feature</code> seem to be duplicated, they appear twice. However, they have different commit IDs.</p>

<p>My history looks a bit like this now (IDs are for demo purposes):</p>

<pre><code>0007 commit from feature #3  &lt;--- these commits are duplicated
0006 commit from feature #2
0005 commit from feature #1
0004 different commit from another branch #2
0004 different commit from another branch #1
0002 commit from feature #3
0002 commit from feature #2
0001 commit from feature #1
</code></pre>

<p>I've made a silly mistake! Is there anything I can do about this? The history looks ugly, but all the correct code seems to be there. Can I remove the duplicated commits? Or is there any other way to clean up the history?</p>

<p>Please write your answer for a less experienced Git user.</p>