This occurs when your local version (on your machine) is "delayed" compared to your remote version (in your case, which is on Github). Imagine the following scenario:
- You create a file
teste.html
with the content below and does the commit
and push
to save to Github
<html>
<head>
<title>Helo World</title>
</head>
<body>
<h1>Helo World</h1>
</body>
</html>
Your coworker who has nothing to do (or even yourself on another machine) looks at this file and changes the texts, translating into Portuguese. Again saved on Github
The other day you want to do an animation test with the title on the page, you commit but when trying to save on Github, do this mistake
The solution is to do the pull
first to sync the location to the remote and then save, but be careful, depending on the situation it may be that some conflict change, if you are using a good IDE it will alert you
In some situations you may want to write the local code on top of the remote, I do it a lot, sometimes I forget to commit some file and go back to the previous commit, recommit (this time with the missing file) and Fasso push
using the option --force
Avoid posting error message as picture.
– Mateus -- O Schroeder