Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git shows files changed, but EGit does not

Tags:

git

eclipse

egit

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?

like image 741
ccleve Avatar asked May 29 '12 18:05

ccleve


People also ask

Why does git show that all my files changed when I didn't change them?

These changes mean that metadata about your file changed, however the content of your file did not. If you're working in a group, this may start to intefere with pushes or just add noise to your commits.

How do you move unstaged changes to staged changes in Eclipse?

Open one of your files, make a change, and you should see it appear in the Git Staging view in the Unstaged Changes window. Drag it into the Staged Changes area, add a commit message, and click Commit. You can also use the Team menu; right-click on the file, choose Team -> Add to Index, then Commit.


1 Answers

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

like image 124
Zoltán Ujhelyi Avatar answered Sep 16 '22 13:09

Zoltán Ujhelyi