title: How to force a git revert
body: <p>My git log looks like this:</p>
  
  <pre><code>commit b265eb43abd7704ed2560cca7c635dbd47b677b0
  Date:   Sun Feb 25 10:20:58 2018 -0500
  
      added C3
  
  commit 536d071bf99059ff8b519ae96ce6e97d92fbc7d7
  Date:   Sat Feb 24 20:50:15 2018 -0500
  
      added B2
  
  commit 6e46e4ff4135b4df55866a5df9af963e3d6ff218
  Date:   Sat Feb 24 11:07:58 2018 -0500
  
      added a
  
  commit 93ad202a08660a62f76496d728a3a89d727350a9
  Date:   Sat Feb 24 11:05:56 2018 -0500
  
      first commit
  </code></pre>
  
  <p>I want to undo my previous commits and go back to commit 6e46e4ff4135b4df55866a5df9af963e3d6ff218. However, I want to preserve the history and do not want to remove "added C3" and "added B2" from the git log, so that rules out git reset --hard 6e46e4ff4135b4df55866a5df9af963e3d6ff218.</p>
  
  <p>I did some reading online and people say that the perfect tool for this is "git revert". I try "git revert 6e46e4ff4135b4df55866a5df9af963e3d6ff218" and see the following</p>
  
  <pre><code>error: could not revert 6e46e4f... added a
  hint: after resolving the conflicts, mark the corrected paths
  hint: with 'git add &lt;paths&gt;' or 'git rm &lt;paths&gt;'
  hint: and commit the result with 'git commit'
  </code></pre>
  
  <p>I opened up the file I am trying to revert and saw the following:</p>
  
  <pre><code>Test
  &lt;&lt;&lt;&lt;&lt;&lt;&lt; HEAD
  
  adding A
  adding B
  adding C
  =======
  &gt;&gt;&gt;&gt;&gt;&gt;&gt; parent of 6e46e4f... added a
  </code></pre>
  
  <p>Someone told me this means I have a "merge conflict". But I do not want to MERGE the current state of the project with the old state of the project - I want to REPLACE the current state of the project with the old state of the project.</p>
  
  <p>Is there any way to simply replace the current state of the project with an old commit, and have that be the new commit? I could do this manually by doing 1) git checkout , 2) copying the checked out project to a backup directory, 3) doing git checkout master in the main folder, 3) deleting all the files in the main folder replacing them with the backup of the old commit. But I would prefer to learn how to do it the git way. I would also prefer to avoid a branching solution, because I want to learn to use "git revert" - if it can't be used in this very basic, straightforward, canonical example, what could it possibly be used for?</p>