1

I am very new to git and already met a lot of bad situations before such as losing commits so a bit scared to do this process myself so, I had two different branches and I merged one of them with master branch and when I tried to merge, it says

This merge has conflicts that must be resolved before it can be committed. To manually merge these changes into master run the following commands:

git checkout master
git merge remotes/origin/edit

Does it mean, I need to enter the given commands and git push origin master again to store the latest version of the master branch on my remote repo.

Jay
  • 87
  • 11
  • What command did you run to generate this error message? – Tim Biegeleisen Sep 19 '18 at 07:17
  • I have merged manually on my remote repo – Jay Sep 19 '18 at 07:19
  • then I did `git pull origin master` on my local repo – Jay Sep 19 '18 at 07:19
  • According to your description, 1st you have to pull from master branch (`git pull origin master`), 2nd resolved conflict, 3rd commit and push to master branch (`git push origin master`) – Arif Sep 19 '18 at 07:20
  • Possible duplicate of [How to resolve merge conflicts in Git](https://stackoverflow.com/questions/161813/how-to-resolve-merge-conflicts-in-git) – phd Sep 19 '18 at 12:08
  • https://stackoverflow.com/search?q=%5Bgit%5D+how+to+resolve+conflicts – phd Sep 19 '18 at 12:09

1 Answers1

0

I hope you have followed the following steps:

  1. Checked out master
  2. Merged branch-A to master
  3. You got conflicts.

If it is the case, then go to the files with conflicts and fix it.

The conflicts will be shown between a head and a tail.

<<<<<<<HEAD
Your local code
=======
Code that is updated from the merge or pull
>>>>>>>id

You could retain the code whichever is required and remove the rest.

Then run the following commands

git add --all
git commit -am "Conflict Fix Message"
git push
Steffi
  • 841
  • 6
  • 7