Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can git be configured to disable merges for particular file types?

Tags:

git

For example, Apple's Interface Builder file format (xib) is, for all practical purposes, impossible to merge. However, because it's a text format, git will happily try to merge files of this type, and this will almost certainly result in corruption if git "succeeds".

Can git be configured to always fail to merge xib files, as it would for binary formats?

like image 944
Amanda Mitchell Avatar asked Dec 19 '11 19:12

Amanda Mitchell


People also ask

How do you stop git from merging?

You can use the git reset --merge command. You can also use the git merge --abort command.

What is git merge command?

The git merge command lets you take the independent lines of development created by git branch and integrate them into a single branch. Note that all of the commands presented below merge into the current branch.

What is git merge -- no FF?

The Git merge --no-ff command merges the specified branch into the command in the current branch and ensures performing a merge commit even when it is a fast-forward merge. It helps in record-keeping of all performed merge commands in the concerning git repo.


1 Answers

Yes. There is a great file called .gitattributes, which allows you to set individual properties for files in your git project. For your purposes, you would fill your .gitattributes with this line

*.xib -crlf -diff

This turns off line-feed correction and disables diff on this file. You can read a little more here or here

like image 120
Chris Mansley Avatar answered Sep 17 '22 14:09

Chris Mansley