Mark W
Mark W

Reputation: 3909

git is telling me all my files are new when they've been added and staged

git is telling me all 300 files that I've been adding/staging/committing all along are now new.

The latest unstaged modified and deleted files were correct, I did a

 git add .
 git add . -A

but neither resolved the 300 new files it still sees.

kinda strange, like my repo has been destroyed or corrupted. I had a fair amount of changes since last staging and commit, and as I said it saw these as modified or deleted.

ETA:

git status is showing (after I did my above commands)

 [(master) +300 ~0 -0]>

Upvotes: 3

Views: 82

Answers (2)

RB Projects
RB Projects

Reputation: 768

I had a scenario where I changed the permissions for the project's directory and all files.

After that, it showed that every file is a new one.

So I git stash my "changes" and went on.
Or you can commit the changes as well.

Hope this helps someone with my case.

Cheers.

Upvotes: 0

VonC
VonC

Reputation: 1323793

One way to recover would be to:

  • do a fresh clone of the repo
  • copy over all the working tree (not its .git subdirectory) of the corrupted repo over the newly cloned and checked out working tree.
  • Let git detect the changes (as opposed to new files)

Upvotes: 1

Related Questions