2

我想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.

第二个问题是在我的另一个 repo 上,它正确地确定了文件是文本(不知道为什么),但仍然无法合并。

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.
4

0 回答 0