After the directory TestDirectory was renamed to lower case (testdirectory) all it's files (a.html and b.html) are shown as modified and even git reset --hard doesn't reset the working tree.
Git always says:
# modified: TestDirectory/a.html
# modified: TestDirectory/b.html
Nothing works to reset the working tree to unmodified state, none of following comma开发者_如何学Cnds help:
git reset --hard
git checkout -- TestDirectory/a.html
I don't understand why this happens and what I can do. Is it git bug?
The rename wasn't added by me but another git user.
git version 1.6.4
I am running Mac OS X 10.6
After playing about an hour my solution was to delete testdirectory/a.html and testdirectory/b.html manually - after that git reported them as "deleted" (I don't want to delete them actually) but it gave me ability to do git pull and get changes when problem was fixed by another user.
Shortly steps:
- Delete files testdirectory/a.html and testdirectory/b.html
- git pull
Note: previously git pull couldn't be done cause merge conflict error.
I didn't clearly understand what's happend but it solved my case. In my opinion Git is still quite complicated like Perl and commands mostly reflects the internals of git rather than user intentions :-)
You could check if git rewrote line endings (git diff shows the file replaced by itself, only with different line endings). When this is the case, you should look at What's the best CRLF (carriage return, line feed) handling strategy with Git?.
精彩评论