t3chb0t
t3chb0t

Reputation: 18744

What kind of changes result in a conflict?

I was wondering whether there is a way to predict and thus avoid conflicts upon merging?

So my question is: what kind of changes actually result in conflicts? It's hard to deduce this from experimentation.

If I make code changes what kind of changes are harmless and what kind of changes will lead to merge problems and will require user attention?

For example:

Are there any rules?

Upvotes: 1

Views: 645

Answers (2)

bolt
bolt

Reputation: 189

Generally, changes that affect the same lines are what cause conflicts. If you add remove a line, and someone else changes it, or you change the indentation and they change the line, you will have a conflict.

That is not to say that changes that don't cause conflicts can't mess things up for each other, as one change 10 lines above yours, that doesn't conflict with yours in source control, can easily remove or rename a variable your change is using. This is why automated build systems exist :)

Upvotes: 1

jeprubio
jeprubio

Reputation: 18032

When in two branches there have been changes in the same files and in the same lines there will be conflicts, otherwise there should be no conflicts.

Upvotes: 1

Related Questions