How to fix the conflicts occured during automatic merge failure

| | 1 min read

Most of us must be familiar with this message. After making the necessary changes to file and after going through the steps like git add, git commit, I tried git pull from server and got the following error message.

"Auto-merging 'filename'
CONFLICT (content): Merge conflict in 'filename'
Automatic merge failed; fix conflicts and then commit the result."

The 'filename' is the name of the file that the changes are made. The reason for this error is git was not able to auto-merge. To fix this or to revert the changes made follow the below mentioned two steps.

  1. git fetch origin
  2. git reset --hard origin