Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Development Tools Git Basics Merging Merge Conflicts

How can we resolve a merge conflict if file is not a text or code?

Let's say I make an edit on an image in a branch and I edit the same image on master. What will happen? Or what happens, for instance, with photoshop files?

1 Answer

Steven Parker
Steven Parker
231,248 Points

With a binary file, you have to decide if you want to keep your version of the file or the one you are merging from.

To commit your file:

  • git checkout --ours -- somepath/foobar.bin
  • git add somepath/foobar.bin
  • git commit

And to commit the file from the other branch, do the same thing but instead of the "ours" option, use "theirs".

Thank you, but what happens when there I do git merge? I will just be prompt to select one of the files?

Steven Parker
Steven Parker
231,248 Points

I think it just informs you that there is a conflict.

Thank you:) Yes, it makes sense. Like, '''merge conflict in image.jpg'''.