title: Problems when it comes to committing changes to git after running 'npm run deploy' on my react app
body: <p>So I have successfully deployed my react project on GitHub pages, there are a lot of useful guides on how to do this. However I am having issues when it comes to updating the project (it is harder to find good guides on this)</p>
  <p>So lets say I make a change to my project on the code as it exists in folders on my computer.</p>
  <p>Then I will run 'npm run deploy'. After doing this, I can see my changes have been successfully implemented on my online deployed site, so all good.</p>
  <p>Then I run the following code to push the changes into the repository:</p>
  <pre><code>git add .
  
  git commit -m &quot;update&quot;
  </code></pre>
  <p>That works fine, but I get an error at the next step:</p>
  <pre><code>git push -u origin master
  </code></pre>
  <p>When I do this I always get the same error message in the terminal:</p>
  <pre><code>error: failed to push some refs to 'https://github.com/redacted/redacted.github.io.git'
  hint: Updates were rejected because the remote contains work that you do
  hint: not have locally. This is usually caused by another repository pushing
  hint: to the same ref. You may want to first 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>
  <p>Can anyone please explain what is happening here, and what this error message means.</p>
  <p>In the error message, does 'remote' mean the code as it exists in the GitHub repo, and 'local' mean the code on my computer? Why does the remote code and local code diverge after running 'npm run deploy'? In future, what is the best way for me to update the repository so that I don't keep running into this problem.</p>
  <p>If it's important, here are my scripts on the package.json file:</p>
  <pre><code>&quot;predeploy&quot;: &quot;npm run build&quot;,
  &quot;deploy&quot;: &quot;gh-pages -b master -d build&quot;,
  </code></pre>