title: Commit and push changes after going back to a particular revision in the repository?
body: <p>We need to go back in time to a particular commit. Some accidental changes were made to master. Attempts to revert it dug too deep, so master is in a bad state. We now want master to go back to 66ada4cc61d62afc.</p>
  
  <p>According to <a href="https://stackoverflow.com/q/6794110/608639">git revert back to certain commit</a>:</p>
  
  <pre><code>$ git reset --hard 66ada4cc61d62afc
  HEAD is now at 66ada4c Updated documentation
  </code></pre>
  
  <p>Then, trying to commit it:</p>
  
  <pre><code>$ git add *.h *.cpp
  $ git commit -m "Go back to Commit 66ada4cc61d62afc"
  On branch master
  Your branch is behind 'origin/master' by 16 commits, and can be fast-forwarded.
    (use "git pull" to update your local branch)
  
  nothing to commit, working directory clean
  </code></pre>
  
  <p>And finally:</p>
  
  <pre><code>$ git push
  To https://github.com/weidai11/cryptopp.git
   ! [rejected]        master -&gt; master (non-fast-forward)
  error: failed to push some refs to 'https://github.com/weidai11/cryptopp.git'
  hint: Updates were rejected because the tip of your current branch is behind
  hint: its remote counterpart. Integrate the remote changes (e.g.
  hint: 'git pull ...') before pushing again.
  hint: See the 'Note about fast-forwards' in 'git push --help' for details.
  </code></pre>
  
  <p>Right now, everything is exactly where I want it to be. I have no idea why Git is having trouble, and what Git is talking about. It sure would be nice if Git did what it was told. But alas, Git makes every simple task difficult, and its going to inflict undue pain and suffering.</p>
  
  <p>How do I commit and push the changes?</p>