Remove commit for good
<p>I know there are thousands of threads for this question.</p>

<p>But I found out something really weird.</p>

<p>If you create a project on GitHub, do some commits.<br>
Let's say commit 1, 2, 3, 4, 5.<br>
Later, you realize you want to change something into commit 3.</p>

<p>As you were working in your own branch, no problem to rewrite history. </p>

<p>So let's do this: (based on <a href="https://stackoverflow.com/a/1186549/2398593">this</a> stackoverflow answer)</p>

<pre><code>git rebase --interactive 'bbc643cd^'

// Modify 'pick' to 'edit' into interactive prompt and :
git commit --all --amend --no-edit
git rebase --continue
git push -f
</code></pre>

<p>Great! The mistake is corrected. 
The history has been rewritten, so the commit <code>bbc643cd</code> is now <code>lkqjfhchc</code>.<br>
You can check the source on your GitHub and everything will have been updated.</p>

<p><strong>But someone can still find it on GitHub!</strong>   </p>

<p>Access the URL: <a href="https://github.com/your-nickname/your-project/commit/bbc643cd" rel="nofollow noreferrer">https://github.com/your-nickname/your-project/commit/bbc643cd</a>... (full commit hash) and you will find it!</p>

<p>How could we remove this commit for good?</p>

<p>Thanks for any help!</p>