Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Few files out of sync but git doesn't seem to notice

Tags:

git

I have two repos that claim to be clean. One was originally cloned from the other and is used for dev work.

There are a few files that I can see are not the same. However when I try pulling either way it says everything is up to date.

How is this possible?

Did that file miss a commit somehow? ...but shouldn't the difference be noticed regardless?

Do I need a refresh of some sort?

like image 578
doublejosh Avatar asked Feb 01 '26 12:02

doublejosh


1 Answers

I seem to have had the same problem.

There was a difference in the working copy and the index which did not show up in git status

cat file # show file in working copy
git show :file # show file in index/staging

these outputs had clear differences while git status said it was a clean working copy.

After some searching i found that the index was probably corrupt and found https://makandracards.com/makandra/5899-how-to-fix-a-corrupt-git-index

rm .git/index
git reset

which fixed the problem for me. If any files were staged they are probably lost but at least now git sees the changes in the local working copy.

like image 196
Bastiaan Deknudt Avatar answered Feb 03 '26 04:02

Bastiaan Deknudt