-2

I have been searching around the internet for a simple definition of a Git conflict without any luck. I somewhat understand what it is but having it defined for me would simplify the process of dealing with them. I would appreciate a middle school description of a Git conflict and ways to prevent them (if any are possible).

ren.rocks
  • 751
  • 1
  • 7
  • 22
  • 3
    this question belongs at http://programmers.stackexchange.com/ – Zach Spencer Jan 15 '15 at 22:52
  • Related: [What constitutes a merge conflict in Git?](http://stackoverflow.com/questions/4920885/what-constitutes-a-merge-conflict-in-git) and [How to minimize merge conflicts when using non-lock VCS like git?](http://programmers.stackexchange.com/questions/219568/how-to-minimize-merge-conflicts-when-using-non-lock-vcs-like-git) – Jonathan Lonowski Jan 15 '15 at 22:54
  • 2
    Conflict is not bad. It just an indication that Git cannot handle it on its own and wants your input. – PM 77-1 Jan 15 '15 at 22:56

1 Answers1

1

A Git Conflict, or generally any version control conflict is a situation where there are differences in the same files between the two branches which are about to be merged. most merge's conflicts can be solvable automatically by the version control system.

Example of a conflict which can be solved automatically:
branch 1: includes file_1.c:
line 1: func_A() {...}
line 2:
line 3: func_B() {...}

branch 2: includes file_1.c: (this modification is newer)
line 1: func_A() {...}
line 2: func_NEW() {...}
line 3: func_B() {...}

Auto merge result:
line 1: func_A() {...}
line 2: func_NEW() {...}
line 3: func_B() {...}

But there are a few cases where the version control system will ask the user to assist in solving the conflict. An example situation is when the same line in the same file was edited in both branches then you'll need to tell Git how to solve this issue - the system will present usually a UI offering you whether to select the version from branch 1 or the version from branch 2 to appear in the final merge result.

Mercury
  • 4,795
  • 1
  • 28
  • 40