Home > Net >  Git merge conflict issue, gir merge conflict while pulling
Git merge conflict issue, gir merge conflict while pulling

Time:07-28

My coworker and I are working in the same branch which was cut from develop. There are many files to be taken care of by both of us. The scenario I’m facing is that I did some changes and pushed my code to the remote repo. My coworker also did some changes in his local and and now he is not able to take a pull. It shows merge conflict while pulling.

Can someone let me know how can we resolve this? Based on my understanding, I think we made some changes in the same files and now to merge them, git is causing that conflict.

CodePudding user response:

First, make sure to use:

git config --global pull.rebase true
git config --global rebase.autoStash true

That way, a simple git pull will:

  • stash your work in progress
  • rebase your local commits (not yet pushed) on top of the updated remote upstream branch (instead of merging). That keep the history linear.

You can also activate rerere in order to not resolve the same conflict over and over again.

Finally, in case of merge/rebase conflict, you will need to chose between "our" and "their" version in each file with conflict markers. As shown here, an IDE can help facilitate the visualization and resolution of such conflicts.

CodePudding user response:

I used tortoise git

git tortoise > git diff

Then I manually resolved the git merge conflict by removing or modifying the code I didn’t want. Then I committed the code and the issues were gone.

  • Related