0

每次我在分支之间切换时都会出错。

我已经这样做了几次:

https://help.github.com/articles/dealing-with-line-endings

    git rm --cached -r .
# Remove everything from the index.


git reset --hard
# Write both the index and working directory from git's database.


git add .
# Prepare to make a commit by staging all the files that will get normalized.

# This is your chance to inspect which files were never normalized. You should 
# get lots of messages like: "warning: CRLF will be replaced by LF in file."

git commit -m "Normalize line endings"
# Commit

并且问题仍然存在。

我的 .gitattribute 文件如下所示:

# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto

# Explicitly declare text files we want to always be normalized and converted 
# to native line endings on checkout.
*.c text
*.h text

# Declare files that will always have CRLF line endings on checkout.
*.sln text eol=crlf

# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary

我得到错误:

“错误:您对以下文件的本地更改将被结帐覆盖:”

4

1 回答 1

2

错误:您对以下文件的本地更改将被结帐覆盖:

发生这种情况是因为某些文件尚未提交到存储库。git add .仅在当前目录中添加跟踪文件。要解决此问题,您可以:

  • 手动添加每个文件 ( git add <file>),给出文件的完整路径,
  • 使用git add -A.

这是git-add.

于 2013-04-05T10:27:27.977 回答