2013-04-05 29 views
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 

我得到的錯誤:

「錯誤:您當地的下列文件中的更改會被檢出覆蓋:」

+0

它被列爲文件夾中的下列文件? 'git add .'只會添加git在直接文件夾中追蹤的文件,而不是子文件夾。 – simont 2013-04-05 09:37:43

+0

是的,這是正確的:o那麼我該如何解決這個問題? – Muqito 2013-04-05 09:38:48

+0

我想規範整個項目 – Muqito 2013-04-05 09:39:15

回答

2

error: Your local changes to the following files would be overwritten by checkout:

這是因爲某些文件尚未提交到存儲庫。 git add .僅在當前目錄中添加跟蹤文件。爲了解決這個問題,你可以:

  • 手動添加的每個文件(git add <file>),給人的完整路徑文件,
  • 使用git add -A

以下是git-add的手冊頁。

+0

非常感謝你<3 – Muqito 2013-04-05 11:32:50