Git + merge conflicts with Windows + Visual Studio caused by line ending Problems between branches

I have a hard time trying to merge correctly with the branches. The branches seem to have problems with line endings because when I open the conflict window in Visual Studio it shows 0 conflicts and 0 differences between multiple files.

I added a gitattributes file in both branches, which searches and updates the repository on both repositories.

When I updated , there were no changes to commit in both repositories, although the instructions there would have been changed for commit (essentially, changes from EOL conversions).

Here are my gitattributes

# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs     diff=csharp

# Standard to msysgit
*.doc    diff=astextplain
*.DOC    diff=astextplain
*.docx   diff=astextplain
*.DOCX   diff=astextplain
*.dot    diff=astextplain
*.DOT    diff=astextplain
*.pdf    diff=astextplain
*.PDF    diff=astextplain
*.rtf    diff=astextplain
*.RTF    diff=astextplain

, core.autocrlf true ( Visual Studio Windows)

, , , , , - - :

enter image description here

.git/config file ( refs)

[core]
    repositoryformatversion = 0
    filemode = false
    bare = false
    logallrefupdates = true
    symlinks = false
    ignorecase = true
    hideDotFiles = dotGitOnly
    autocrlf = true
[merge]
    renormalize = true

, / - googling, - .

: GIT TFS - , .

1: "" Visual Studio, Notepad ++ " → ", - "" , ( CR/LF, ) - , VS EOL - ? Notepad ++, - EOL? , .

enter image description here

Visual Studio 2015 3

2: End of Line Visual Studio Extension, EOL, EOL /diff, , .

3: - , - ... , , , ... , FROM, CRLF, INTO LF - , EOL. , ? , , , , -, .

( : CRLF , CRLF LF): enter image description here

: enter image description here

+4
2

, , .gitattributes. . .gitattributes , .

# Set behaviour for all files, in case developers don't have core.autocrlf set.
* text=auto

# Explicitly declare text files we want to always be normalized and converted to native line endings on checkout.
*.txt text

# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf

# Denote all files that are truly binary and should not be modified.
*.zip binary
0

core.autocrlf = true, repo (TFS) LF, GIT CRLF. , ,

" CRLF, ".

, , , CRLF, , (LF), uppon merge. , , , LF CRLF , , .

CRLF eol auto, , CRLF → LF commit LF → CRLF .

*.cs                  text eol=crlf
*.xaml                text eol=crlf
*.csproj              text eol=crlf
*.sln                 text eol=crlf

, , CRLF LF. .gitattributes ( , CRLF, LF )

git rm --cached -rf .
git diff --cached --name-only -z | xargs -n 50 -0 git add -f

, .gitattributes , :

git rm -rf --cached .
git reset --hard HEAD
0

Source: https://habr.com/ru/post/1670303/


All Articles