6

I was working on a branch. I made some changes to a file person.cs that I wanted to apply to a co-worker's branch. Last week I had been working on his branch, but lately I have been working on my own branch.

I switched to his branch and pulled to get his most recent changes. After the pull I got merge conflicts in people.css , a file that I had never even opened.

Why would I get merge conflicts?

thepaulpage
  • 4,449
  • 2
  • 22
  • 38
  • What is the diff output between your and his branch before you change the single file? His branch may be ahead with several changes already. Another thing to check: You are both on the same OS? Some OSes use case insensitive file systems, and there can be some surprises. – Eric Platon Dec 31 '14 at 15:36
  • Same OS. It looks like the diff between his branch and mine basically consists of the files that I'm getting conflicts on (+ others that aren't giving me conflicts) – thepaulpage Dec 31 '14 at 15:42
  • That means his branch contains changes you don't have. You may need to first get his changes, then apply yours on top (to `person.cs`). Be careful before proceeding, as you may not want or be allowed to actually merge all his changes. Sometimes, a cherry pick is the solution. Investigating conflicts can be time-consuming, but VCSs like Git have powerful tools :-) – Eric Platon Dec 31 '14 at 15:51
  • but when I tried to get his changes, it gave me merge conflicts – thepaulpage Dec 31 '14 at 16:15
  • Two ideas: (1) can you identify the conflicts? The resolution strategy depends on your situation... But if the diff shows changes, the conflicts will need be addressed. A good start is to decide which branch is the reference... (2) how about `git cherry-pick` ? – Eric Platon Dec 31 '14 at 16:29
  • Is the remote version of the branch a fast-forwrd of yours? If not, it could be possible that there are commits on your branch that were not committed by you, but are nevertheless, not on the current branch that change the conflicted file(s). – Joseph K. Strauss Jan 01 '15 at 03:30
  • I know this question is old, but I stumbled upon it. IMHO the question lacks of infrmation to enable people to work out a solution. It should at least provide git output (about pull, diff, etc.) of the situation... – fose Sep 08 '17 at 17:49
  • @fosb The question is old, yes. I've moved past it (by just taking one side of the changes) but I still don't know what's going on. I don't have any of what you're asking for. I believe that a co-worker had a similar problem just last week though – thepaulpage Sep 11 '17 at 12:40

0 Answers0