Amadeu Cabanilles Amadeu Cabanilles - 1 year ago 148
Git Question

Git does not detect new files

According to my Eclipse I am working in


This is my git status

$ git status
On branch develop
Your branch is up-to-date with 'origin/develop'.

nothing to commit, working directory clean

But listing the files, there are files that are present in my project but not in the branch that I would like to add them

git ls-files

I've also created a new Java file in Eclipse and is not detected for git

Answer Source

If you see files under git ls-files and they don't show under git status then probably they are already inside the index, and - most likely - commited.

You can use git cat-file -p HEAD:filename to check content of object in the repository.

My guess is that you have assume-unchanged (this prevents any changes to show up in status) or skip-worktree flags set inside index. You can check it via git ls-files -v file. If in first column you see:

  • lovercase letter it means you have assume-unchanged flag set as true: git update-index --no-assume-unchanged file should help.
  • S or s you have skip-worktree flag set as true, and unsetting it should help: git update-index --no-skip-worktree file
  • if you see H it means that file has been commited and it has not been modified.

There's also a possibility that your's index is corrupted, you could try git update-index --really-refresh or deleting .git/index (Git should recreate that for you when necessary)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download