最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

git checkout - git file always shows modified vs local index - Stack Overflow

programmeradmin0浏览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
发布评论

评论列表(0)

  1. 暂无评论