ccleve
ccleve

Reputation: 15779

Git shows files changed, but EGit does not

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?

Upvotes: 6

Views: 1361

Answers (2)

ccleve
ccleve

Reputation: 15779

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.

Upvotes: 1

Zoltán Ujhelyi
Zoltán Ujhelyi

Reputation: 13858

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).

Upvotes: 1

Related Questions