请告诉我有合并=我们.gitattributes的正确用法 [英] Whats the Proper usage of .gitattributes with merge=ours

查看:2486
本文介绍了请告诉我有合并=我们.gitattributes的正确用法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是用.gitattributes首次尝试。我想我必须做一些错误的,因为它不工作,因为我想用的目的合并=我们属性的目的是为(?)。

I just tried using .gitattributes for the first time. I figure I must be doing something wrong because it is not working as I thought the purpose of using the merge=ours attribute was intended for (?).

我使用的一个例子:

我有两个分支;一个是主,另一个是GCE-网站。有迹象表明,有上也存在,我不想融入主[或其他分支机构]主分支不同的设置对GCE-网站分支中的文件。

I have two branches; one is the "master" and the other is "GCE-Site". There are files on the "GCE-Site" branch that have different settings that also exists on the "master" branch that I do not want merging into the "master" [or other branches].

在两个分支,我有一个 .gitattributes 包含以下规则:

On both branches, I have a .gitattributes containing the following rules:

README.md merge=ours
config.php merge=ours
.gitattributes merge=ours
.gitignore merge=ours
.cache/ merge=ours

所有文件需要的规则都在根级别加上一切.cache /文件夹的上方。当我做了混帐合并GCE-网站,所有文件还是合并到主设备时,我不希望出现这种情况。

All the files needing the rules are on the root level plus everything above the .cache/ folder. When I do a git merge GCE-Site, all files still merge into the master when I don't want that.

有我丢失的东西?你的帮助是很大的AP preciated。日Thnx

Is there something I am missing? Your help is greatly appreciated. Thnx

推荐答案

容易解决,一旦我知道我在做什么:我错过了与混帐配置--global merge.ours.driver加入合并策略真正在我的本地环境。

Easy fix once I knew what I was doing: I missed adding the merge strategy with git config --global merge.ours.driver true in my local environment.

这篇关于请告诉我有合并=我们.gitattributes的正确用法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆