title: How do i delete the last 3 commits?
body: <p><strong>How do i delete the last 3 commits?</strong> there is probably many examples but I think i ma being very specific here with what I want.</p>
  
  <p>So for example I have done a <code>git add .</code> and <code>git commit -m "message"</code> and a <code>git push -u origin master</code> for all these.</p>
  
  <p>I have the following output from all my commits(with 21 being the most recent commit)</p>
  
  <pre><code>$git log --pretty=oneline
  [[33mab18ba3884244e99d99122e788062b2aaf6ba372[[m commit-21
  [[33m9625c19e03a747457162d7c0274d75b154a0b926[[m commit-20
  [[33m8668df12af9eee540cc29f9deb6d31d873bb8f24[[m commit-19
  [[33m8315cd7962c902d39160fcf2fd018f249e7cf744[[m commit-18
  [[33m3bcecc602a70fb60324777831d51c81b6f9ccaa7[[m commit-17
  [[33m0485a39c37e72eabb4003e07a6b8cbae7a0d4e25[[m commit-16
  [[33m9d3b04a7bcbb82be8b6b7882511f8133745c93b6[[m commit-15
  [[33m22c259497571390fdd1461f0dd6b77244851984b[[m commit-14
  [[33m39fb965fc245be55bb86491b5871dd2def08fdf4[[m commit-13
  [[33m299f6bb77e922d707c9981a48d4d75f57b724719[[m commit-12
  [[33me7285377d7afc08c7a5fb0ca44154d2de7e1d275[[m commit-11
  [[33mb3360786ef13044d13b6e58c2239cce5595a1abf[[m commit-10
  [[33m9af4c134e0d239d1c34fc6bb6087f0473c187fd5[[m commit-9
  [[33md55ac3370f506a4bbf8a4690b9285e5de9c6a671[[m commit-8
  [[33me50ef5f58b18d05c36343114804d8be180d26bcb[[m commit-7
  [[33m962e4a8de7649e06df29f9058a600f8318caf023[[m commit-6
  [[33m37f5363f62a3f973fe6e0d516e47b4324186d998[[m commit-5
  [[33m0033e32339e4dc0cce8bd208d43b18a4e9ab43d9[[m commit-4
  [[33m345239c740a408826f1df0dc5592d5d6b355f019[[m commit-3
  [[33m8c85bf2592f52302ff389a5b6af4127fbe04c73b[[m commit-2
  [[33ma4077b6c2b6a491af72ae3afc3b5c6260090b605[[m commit-1
  </code></pre>
  
  <p>What I want to do is effectively delete the last 3 commits and end up with this:(So it was like git commit 19, 20 and 21 never happened)</p>
  
  <pre><code>$git log --pretty=oneline
  [[33m8315cd7962c902d39160fcf2fd018f249e7cf744[[m commit-18
  [[33m3bcecc602a70fb60324777831d51c81b6f9ccaa7[[m commit-17
  [[33m0485a39c37e72eabb4003e07a6b8cbae7a0d4e25[[m commit-16
  [[33m9d3b04a7bcbb82be8b6b7882511f8133745c93b6[[m commit-15
  [[33m22c259497571390fdd1461f0dd6b77244851984b[[m commit-14
  [[33m39fb965fc245be55bb86491b5871dd2def08fdf4[[m commit-13
  [[33m299f6bb77e922d707c9981a48d4d75f57b724719[[m commit-12
  [[33me7285377d7afc08c7a5fb0ca44154d2de7e1d275[[m commit-11
  [[33mb3360786ef13044d13b6e58c2239cce5595a1abf[[m commit-10
  [[33m9af4c134e0d239d1c34fc6bb6087f0473c187fd5[[m commit-9
  [[33md55ac3370f506a4bbf8a4690b9285e5de9c6a671[[m commit-8
  [[33me50ef5f58b18d05c36343114804d8be180d26bcb[[m commit-7
  [[33m962e4a8de7649e06df29f9058a600f8318caf023[[m commit-6
  [[33m37f5363f62a3f973fe6e0d516e47b4324186d998[[m commit-5
  [[33m0033e32339e4dc0cce8bd208d43b18a4e9ab43d9[[m commit-4
  [[33m345239c740a408826f1df0dc5592d5d6b355f019[[m commit-3
  [[33m8c85bf2592f52302ff389a5b6af4127fbe04c73b[[m commit-2
  [[33ma4077b6c2b6a491af72ae3afc3b5c6260090b605[[m commit-1
  </code></pre>
  
  <p><strong>Note:</strong>
  I have looked into this and can't quiet get what I want. I have tried <a href="https://nakkaya.com/2009/09/24/git-delete-last-commit/" rel="noreferrer">git revert</a>(this is advise if I have published which I presume is the same as <code>git push -u origin master</code>) <code>git rebase</code> <a href="https://stackoverflow.com/questions/1338728/delete-commits-from-a-branch-in-git">git reset</a><br>
  I am not concerned with my remote at this stage I jsut want to get my local repo put back a couple of repos.</p>