告诉 git 不要合并二进制文件而是选择
当二进制文件、swf、jar 和 flv 在本地更改时,我尝试引入更改,git 会尝试合并它们并报告冲突。
然后,我分支到一个临时分支,并提交本地更改的二进制文件,并在拉取后使用递归策略将它们合并回来。 ——工作量太大了。
有没有办法告诉 git,不要尝试合并二进制文件并询问我使用这些版本中的哪一个。
When the binary files, swfs, jars and flvs are changed locally, and I try to pull in changes, git tries to merge them and reports conflict.
And then, I branch to a temporary branch, and commit the local changed binary files, and merge them back after the pull with recursive theirs strategy. -- Too much work.
Is there a way to tell git, not to attempt merging binary files and ask me which one of these versions to use.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以在
.gitattributes
文件中设置合并驱动器(仅适用于给定子树,仅适用于某些文件类型)请参阅这个问题(或这个)。
在 Git 存储库的配置中声明您的合并驱动程序:
或者
我给出的示例不会要求您进行选择,但在合并时将始终保留“我的”(或“您的”)版本。
但是您可以调整此合并驱动程序执行的脚本来询问您问题,然后将您的选择应用于所有合并。
You could set up a merge drive in a
.gitattributes
file (only for a given subtree, only for some file types)See this question for instance (or this one).
Declare your merge driver in the config of the Git repo:
or
The example I give don't ask you for a choice but will always keep "mine" (or "yours") version when merging.
But you could adapt the script executed by this merge driver to ask you a question, and then apply your choice to all merges.