I\'m experiencing the same issues as in this question: git status shows modifications, git checkout --
Git continues to show wor
Although i don't know what is causing this weird behaviour, i know one more way of discarding changes that might work.
Warning! Be extremely careful and do a backup first; this can be highly destructive.
If all data that you care about is committed in the repository, you can simply delete everything in your working directory (of course except hidden .git directory) and run git reset --hard HEAD
to have git recreate the working directory solely from the repository data.
Remember to carefully check if you don't have any important data that is not tracked by git before doing this. It's not enough to check git status
for uncommitted changes - remember that deleting all files from the working dir will also delete files which you told git to ignore, and they won't be recreated with git reset --hard HEAD
because they're not tracked at all.
Check if you have no .gitattributes
file
As mentioned in the "Effect" section of the gitattributes man page, those files can also have an effect on eol and automatic transformation:
text ^^^^^^
This attribute enables and controls end-of-line normalization.
When a text file is normalized, its line endings are converted toLF
in the repository.
To control what line ending style is used in the working directory, use the eol attribute for a single file and thecore.eol
configuration variable for all text files.
Check also your config for core.eol
, as mentioned in "How line ending conversions work with git core.autocrlf between different operating systems".
This problem can be caused by gitattributes' text option.
Please read the documentation carefully but essentially autocrlf
only matters if text
is not set in a .gitattributes
:
Unspecified
If the text attribute is unspecified, git uses the core.autocrlf configuration variable to determine if the file should be converted.
Find your .gitattributes
file via:
find <root-dir> -name .gitattributes
And grep
for text
, eol
or crlf
to find your culprit and revise as necessary.
You may just change this file and revert the change without committing for long enough to get through your issue.
"autocrlf" issue is a typical issue for cross multi platform repo (i.e. using a samba share with tortoisegit over a server under linux)
I realized, that sometimes (often), it's more a "chmod" issue than a autocrlf one : - git status windows display pending modifications - git status linux display nothing
"mode change 100755 => 100644 config/packager.xml"
Check that your "static" files are not +x, (and in this case tortoisegit wont like it)
I'm investigating the weird behavior of core.autocrlf in MSysGit, and I found that having:
[core]
autocrlf = false
safecrlf = true
ignorecase = true
eol = native
in the global config file and NO core.autocrlf setting in a repo copied from another PC (not cloned, only copied), issuing a git status
command results in ALL text files marked as modified (no gitattributes around).
But if you add a local (repository) core.autocrlf setting to true, and then issue a git status
command, all the changes disappears and the repository turns back to be clean.
BUT (and this is the strange behavior) if you remove the just added core.autocrlf setting from the repository config file (thus returning to the exact initial state), the git status command continues to report no changes!
Given that no operations has been performed on the repository, only changing a config setting, and reverting back to the original state, has done the trick...
If this isn't a bug, I can't imagine who in the world can call this a "normal" behavior.
This seems like a bug in msysgit indeed. As a workaround, try creating a .gitattributes file containing
* -text
This will tell git not to perform EOL conversions on any files.