Merge Conflicts

This can happen when your remote repository and local repository are out of sync.
One of the most common conflict scenarios goes as follows:

  1. Make changes to files(s) in the repository on GitHub.
  2. Commit changes.
  3. Then make changes to the same file(s) on your local computer without making a pull request first.
    git branch
    git add .
    git commit -m "added image"
  4. Push the local changes
    git push origin add-readme
  5. Push fails! Updates are rejected because you did not make a pull request to get the most recent files first.
  6. Make a pull request
    git pull origin add-readme
  7. A conflict is created!

 

Conflict Resolution

You can resolve the conflict by simply opening the changed files in which the conflict exists and choosing what to changes keep.
Then commit and push your final changes to the repository on GitHub

Remember,

“Always pull before you push!”