0

I have cloned branch from develop branch and made some changes on it then raised pull request but in BitBucket I have the below error

Conflict: Modified on Source, Modified on Target This file is in a conflicted state. You will need to resolve the conflict manually before you can merge this pull request

My branch name - social cloned branch - develop

I could see many forums but could not get resolve the issue. I would want to resolve one single file. Is there any way to do in git?

Lajos Arpad
  • 64,414
  • 37
  • 100
  • 175
ezhil
  • 977
  • 6
  • 15
  • 36
  • 1
    Does this answer your question? [How to resolve merge conflicts in Git](https://stackoverflow.com/questions/161813/how-to-resolve-merge-conflicts-in-git) – Greg Burghardt Mar 03 '20 at 18:27

2 Answers2

1

The error tells you that you need to resolve the merge conflict manually. This means that you need to open the file with a text editor and search for the text of

<<<<<<<

which is the start of a conflict, unless this text was genuinely written into your file. The merge conflict ends with

>>>>>>>

so, between the two you have your conflict. The conflict means that the file you had and the file you have downloaded differ in the conflict. Between the two version there is a separation of

=======

Look at both versions and decide which is correct. If neither, then copy-paste the one which is closer to being correct and fix it.

Lajos Arpad
  • 64,414
  • 37
  • 100
  • 175
0

This is probably happening because there has been changes in the develop branch since the time you cloned the repo. So git history is something like this:

A - D1             (develop branch)
  \- Y1 - Y2       (your branch)

A is the commit where you checked out your branch and added commits Y1 and Y2. In the meanwhile, D1 was added on the develop branch. And basically D1 introduced changes that conflict with your changes in Y1 and Y2. There are two ways to fix this: 1. Merge the latest develop to your current branch and manually resolve the conflicts. 2. Rebase the latest develop on your current branch and manually resolve the conflicts. The rebase would result in a nicer linear history without any merge commits.

Ankur Ankan
  • 2,953
  • 2
  • 23
  • 38