title: error: failed to push some refs to 'git@github.com:<name>/<project>.git'
body: <p>Hi I'm a total newbie using git I read a few StackOverflow Q&amp;A on this error but didn't understand how my problem relates to others with the same error message.  So I didn't dare to chance it and loose 6 hours of work that I need to push to my remote GitHub repo.</p>
  
  <p>.</p>
  
  <p><strong>1.) The Beginning</strong></p>
  
  <p>So my code in the local working directory got broken and I couldn't figure out what the problem was.  So I wanted git to go back to the latest working version of my project.  I then found this tutorial and managed to get my local project to go back to a working version.
  <a href="https://www.git-tower.com/learn/git/faq/restore-repo-to-previous-revision" rel="nofollow noreferrer">https://www.git-tower.com/learn/git/faq/restore-repo-to-previous-revision</a></p>
  
  <pre><code>$ git reset --hard &lt;SHA-1 HASH NUMBERS&gt;
  </code></pre>
  
  <p>.</p>
  
  <p><strong>2.) Trying to push</strong></p>
  
  <p>These are the commands I usually follow when I want to push local code to my remote repo.</p>
  
  <pre><code># Pushing Changes - Staging
  $ git diff
  $ git status
  $ git add -A
  $ git status
  $ git commit -m "Modified multiply function."
  
  # Pushing Changes - Repository
  $ git pull origin master
  $ git push origin master
  </code></pre>
  
  <p>.</p>
  
  <p><strong>3.) The error</strong></p>
  
  <p>I don't understand what the error message is trying to tell me.  Can somebody help me by showing what sequence of commands I need to run to be able to push code like usual again?</p>
  
  <pre><code>penguin@linux$ git push origin master
  
  To git@github.com:&lt;name&gt;/&lt;project&gt;.git
  
   ! [rejected]        master -&gt; master (non-fast-forward) error: failed to push some refs to 'git@github.com:&lt;name&gt;/&lt;project&gt;.git'
  
  hint: Updates were rejected because a pushed branch tip is behind its remote 
  hint: counterpart. Check out this branch and integrate the remote changes
  hint: (e.g. 'git pull ...') before pushing again.
  hint: See the 'Note about fast-forwards' in 'git push --help' for details.
  </code></pre>