gpt4 book ai didi

xcode - Git 和 pbxproj

转载 作者:IT王子 更新时间:2023-10-29 01:01:36 26 4
gpt4 key购买 nike

我正在查看一个开源 Mac 应用程序,他们为 .gitignore 提供了一些建议值。他们是我所期望的...

但是,他们还建议进入 .gitattributes 文件:

*.pbxproj -crlf -diff -merge

我不是最了解 git 的人,所以我想知道 - 添加这一行到底有什么好处?具体做什么?我只在这个 one project 中看到过这个建议, 如果这是正常的做法,我希望现在可以在其他地方看到它。所以我很好奇它是如何具体应用于 pbxproj 文件的。

最佳答案

pbxproj 文件并不是真正可由人类 merge 的。虽然它是纯 ASCII 文本,但它是 JSON 的一种形式。本质上,您希望将其视为二进制文件。

这是各个标志的作用:

-crlf: 不要使用 crlf <=> cr 转换

-diff: 不比较文件

-merge: 不要尝试 merge 文件

来自Pro Git Scott Chacon 的书

Some files look like text files but for all intents and purposes are to be treated as binary data. For instance, Xcode projects on the Mac contain a file that ends in .pbxproj, which is basically a JSON (plain text javascript data format) dataset written out to disk by the IDE that records your build settings and so on. Although it’s technically a text file, because it’s all ASCII, you don’t want to treat it as such because it’s really a lightweight database — you can’t merge the contents if two people changed it, and diffs generally aren’t helpful. The file is meant to be consumed by a machine. In essence, you want to treat it like a binary file.

关于xcode - Git 和 pbxproj,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1549578/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com