让我们看一下分阶段和/或修改过的文件:
$git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: .gitattributes
modified: .gitignore
no changes added to commit (use "git add" and/or "git commit -a")
让我们尝试回滚更改:首先从.gitattributes
开始:
15:52:22/ $git checkout -- .gitattributes
15:52:40/$git status
On branch master
Your branch is up-to-date with 'origin/master'.
Changes not staged for commit:
modified: .gitattributes
modified: .gitignore
答案 0 :(得分:0)
原因是从基于Windows CRLF的文件拉到* Nix(macos)。 CRLF正在自动转换为LF - 但这会导致文件“编辑”。 git checkout
也会导致同一更新发生。
我现在必须弄清楚如何避免CRLF问题:但无论如何问题都不在于checkout --