How do I make Git treat a file as binary?

后端 未结 2 693
清歌不尽
清歌不尽 2020-12-13 03:11

Having a problem with a medium sized project where visual studio project files keep having issues due to git treating them as text and merging. I\'d like to just set the fil

2条回答
  •  醉话见心
    2020-12-13 03:47

    You should define binary file attributes in your .gitattributes file (create it if it doesn't exist) by putting these lines in it, to prevent it to handle it as text diff file:

    # Define binary file attributes.
    # - Do not treat them as text.
    # - Include binary diff in patches instead of "binary files differ."
    *.sln     -text diff
    *.suo     -text diff
    *.vcxproj -text diff
    *.gif     -text diff
    *.gz      -text diff
    *.ico     -text diff
    *.jpeg    -text diff   
    

提交回复
热议问题