git:在rebase期间自动与union策略合并

时间:2013-11-27 18:12:53

标签: windows git merge rebase gitattributes

我希望在执行git rebase时自动合并.csproj文件,方法是保留所有添加的行:

mkdir example
cd example

git init
echo "*.csproj text merge=union" > .gitattributes
echo "hello" > sample.csproj
git add -A
git commit -m "initial commit"

git branch test
git checkout test
echo "from test" >> sample.csproj
git add -A
git commit -m "from test"

git checkout master
echo "from master" >> sample.csproj
git add -A
git commit -m "from master"

git rebase test

有两个问题。首先,这失败并带有二进制警告:

Falling back to patching base and 3-way merge...
warning: Cannot merge binary files: sample.csproj (HEAD vs. from master)
Auto-merging sample.csproj
CONFLICT (content): Merge conflict in sample.csproj
Failed to merge in the changes.

第二个问题是在我的另一个回购中它正确确定文件是文本(不确定原因)但仍然无法合并。

Falling back to patching base and 3-way merge...
Auto-merging Source/App/TRPS.Build/TRPS.Build.csproj
CONFLICT (content): Merge conflict in Source/App/TRPS.Build/TRPS.Build.csproj
Failed to merge in the changes.

0 个答案:

没有答案