BaltoStar
BaltoStar

Reputation: 8997

git file always shows modified vs local index

On Windows working with C# files

I think what may be happening here is that in the local index the file has LF line-endings. So even when git restore myfile or git checkout myfile git immediately changes LF to CRLF and consequently file shows as modified. Even get stash fails to change this file's status, it will still show as modified. What is a solution ?

PS C:\git\mypath> git status
On branch mybranch
Your branch is up to date with 'origin/mybranch'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   myfile.cs

no changes added to commit (use "git add" and/or "git commit -a")

PS C:\git\mypath> git checkout myfile.cs
Updated 1 path from the index

PS C:\git\mypath> git status
On branch mybranch
Your branch is up to date with 'origin/mybranch'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
        modified:   myfile.cs

Upvotes: 0

Views: 28

Answers (0)

Related Questions