title: How to delete the last n commits on Github and locally?
body: <p>I'm trying to delete the last 2 commits from one of my GitHub repositories. I've tried as suggested <a href="https://stackoverflow.com/questions/448919/how-can-i-remove-a-commit-on-github">here</a> : <code>git push -f origin HEAD^^:master</code>. It seems that it works, as the last two commits are removed.</p>
  <p>Then I deleted them from my local repository with <code>git rebase -i HEAD~2</code>. I remove the lines that are related to those commits, and check with <code>git log</code> that they are correctly removed.</p>
  <p>After that, I make some changes in my local repository, make a new commit, and push to GitHub. The problem is that, in my GitHub account, I have the previous two commits that I've tried to delete.</p>
  <p>I think the problem is in my local repository, because if I clone my Github repository to my local and make some changes here, when I push a new commit those old commits aren't pushed to GitHub.</p>