在分支之间切换给我错误

时间:2013-04-05 09:27:32

标签: git github

每当我在分支之间切换时,我都会收到错误。

我做过几次这样的事情:

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

我收到错误:

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

覆盖

1 个答案:

答案 0 :(得分:2)

  

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

覆盖

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

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

以下是git-add的手册页。