Merge Conflicts - Bitbucket, Sourcetree. How do I get around this?

Have been working on a project in Unity with a friend and the friend created his own branch called Danny’sBranch.

Changes were made in the Master’s branch while Danny worked on Danny’s branch. I tried to merge the branches. The Unity project itself seems to have stuff from both branches but there are a lot of errors.

The errors from sourcetree are the following:

git -c diff.mnemonicprefix=false -c core.quotepath=false merge origin/DannysBranch
Auto-merging marble-action-now.userprefs
CONFLICT (content): Merge conflict in marble-action-now.userprefs
Auto-merging Library/metadata/92/92e6676b2a6c31945a7cf6b6ac40ca57
CONFLICT (content): Merge conflict in Library/metadata/92/92e6676b2a6c31945a7cf6b6ac40ca57
Removing Assets/TARGET.obj.meta
Auto-merging Assets/Scripts/GameManager.cs
CONFLICT (content): Merge conflict in Assets/Scripts/GameManager.cs
Auto-merging Assets/Scenes/Scene1.unity
CONFLICT (content): Merge conflict in Assets/Scenes/Scene1.unity
Auto-merging Assets/Prefabs/PC 1.prefab
CONFLICT (content): Merge conflict in Assets/Prefabs/PC 1.prefab
Auto-merging Assembly-CSharp.csproj
Automatic merge failed; fix conflicts and then commit the result.
warning: Cannot merge binary files: Library/metadata/92/92e6676b2a6c31945a7cf6b6ac40ca57 (HEAD vs. origin/DannysBranch)
warning: Cannot merge binary files: Assets/Scenes/Scene1.unity (HEAD vs. origin/DannysBranch)
warning: Cannot merge binary files: Assets/Prefabs/PC 1.prefab (HEAD vs. origin/DannysBranch)

The main question would be, what should we do to fix this problem?


You need to setup your project for version control. Read:

The important parts are Asset Serialization set to “force text”, Version Control mode set to “Visible meta files” and Smart Merge.
You find more on Smart merge and conflicts here:

There still might be conflicts though that you have to merge manually. To do this you have to know the YAML Format:

Don’t check in Library files, you can simply setup a git ignore file to ignore this and other folders: