我有以下目录结构:
/.git
/.git/info/attributes
/MyProject
/MyProject/pom.xml
/MyProject/MyCode.java
Run Code Online (Sandbox Code Playgroud)
我有分支主和bugfix.在两个分支上都修改了pom.xml和MyCode.java.我想将仅来自bugfix的更改合并到MyCode.java的master,并保留pom.xml文件的主版本.
所以我添加了"/.git/info/attributes"因为我不想在项目中提交.gitattributes
$cat .git/info/attributes
pom.xml merge=ours
$git status
# On branch master
nothing to commit (working directory clean)
$git check-attr -a pom.xml
pom.xml: merge: ours
Run Code Online (Sandbox Code Playgroud)
最后到了问题:
当我做:
$git merge bugfix
Auto-merging MyProject/pom.xml
CONFLICT (content): Merge conflict in MyProject/pom.xml
Automatic merge failed; fix conflicts and then commit the result.
Run Code Online (Sandbox Code Playgroud)
Git忽略了属性设置.我在这里失踪了什么?
我不想在这篇文章中定义"keepMine.sh"
这篇文章是我需要的,但是如果我有一个简单的模式,我宁愿不逐个文件
谢谢!