6

Git noob here. Having a hard time figuring out why git shows some files changed, while Eclipse EGit does not.

When I use EGit within Eclipse and view a project, it shows no files changed. There is no little caret next to each file. When I use Git for Windows, or go to the command line and type "git status", it shows that all the files have been modified. When I type "git diff" it shows two different versions of a file, first red, then green, and there appears to be some whitespace differences, but I can't be sure, and I can't figure out how the whitespace changed in every file in the project. (Something here doesn't add up.) "git diff -w" returns nothing. "git config --global apply.whitespace nowarn" does nothing.

I might be having a basic conceptual problem with git.

In any case, why do EGit and the git command line show different results?

2 Answers 2

1

EGit understands the notion of Derived resources (e.g. used for generated .class files in JDT). In other words, files in derived resources are not added to version control by default in EGit. However, the command line git client does not know these markers, but relies on .gitignore files to avoid checking in generated files.

To check whether your problematic files are derived, open the file properties dialog (right click on the file in the explorer, and select Properties...), and on the Resources page check for the Derived checkbox (it should be around the middle of the dialog).

1
  • Nope... the modified files all have the .java extension. I already added /target, with the .class files, to .gitignore.
    – ccleve
    Commented May 30, 2012 at 19:32
1

It turns out that git is playing games with newlines. It's inexplicable. Bottom line: EGit and the git command line cannot both be used on a Windows box. To get consistency, you have to use one or the other.

Not the answer you're looking for? Browse other questions tagged or ask your own question.