Everytime the modelsbuilder detects a change in LiveAppData moe, the generated file will be touched.
Git uses auto line-endings, meaning CRLF on windows, while the umbraco models builder uses LF (https://github.com/modelsbuilder/ModelsBuilder.Original/blob/v4/dev/src/Our.ModelsBuilder/Building/CodeWriterBase.cs#L65) This is seen as a change, but when running git add this change is corrected by git and then dropped.
This is very annoying, but easy to fix with a .gitattributes file. As a base I've used the one in the UmbracoCms repository, and extended it with the path to the models builder output:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*.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 | |
*.jpg binary | |
*.png binary | |
*.gif binary | |
*.cs text=auto diff=csharp | |
*.vb text=auto | |
*.c text=auto | |
*.cpp text=auto | |
*.cxx text=auto | |
*.h text=auto | |
*.hxx text=auto | |
*.py text=auto | |
*.rb text=auto | |
*.java text=auto | |
*.html text=auto | |
*.htm text=auto | |
*.css text=auto | |
*.scss text=auto | |
*.sass text=auto | |
*.less text=auto | |
*.js text=auto | |
*.lisp text=auto | |
*.clj text=auto | |
*.sql text=auto | |
*.php text=auto | |
*.lua text=auto | |
*.m text=auto | |
*.asm text=auto | |
*.erl text=auto | |
*.fs text=auto | |
*.fsx text=auto | |
*.hs text=auto | |
*.json text=auto | |
*.xml text=auto | |
*.ts text=auto | |
*.tsx text=auto | |
*.csproj text=auto merge=union | |
*.vbproj text=auto merge=union | |
*.fsproj text=auto merge=union | |
*.dbproj text=auto merge=union | |
*.sln text=auto eol=crlf merge=union | |
# Models builder uses LF as line-endings | |
# https://github.com/modelsbuilder/ModelsBuilder.Original/blob/v4/dev/src/Our.ModelsBuilder/Building/CodeWriterBase.cs#L65 | |
/src/Your.Umbraco.Website.Website/Path/To/Generated/Models/*.cs text eol=lf | |
*.gitattributes text=auto |