0

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
1
  • 1
    Try git add myfile.cs and then git status and git diff --cached if there are substantial changes (i.e., something other than line endings). Commented Feb 6 at 6:50

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.