0

I've recently pulled down the latest version of a branch and it's created a folder of files which are in the last commit, however git seems to think all these files are still modified and none of the following will 'reset' the files to the latest commit, making git think there aren't any changes:

git reset --hard

git reset --hard origin/production

git checkout --

git checkout-index

rm -rf lib/problem-folder

git rm --cached -r lib/problem-folder

git stash
git stash drop

git config core.filemode false

git status --porcelain | grep "^ M" | cut -c4- | xargs rm
git checkout -- .

And there is no .gitattributes file.

If I move HEAD back 2 commits (one merge, one actual commit) then the files are fine, so I guess it must be an issue with the commit? It's the production branch and has already been merged into some other branches (don't ask) so I don't really want to have to re-do the commit

eddhall
  • 193
  • 17
  • It seems a problem of end of lines. – Philippe Jan 23 '18 at 21:47
  • 1
    (1) Are you using Windows and/or Mac OS X? (2) If so, are you using a case-folding file system? (3) If using Windows, have you enabled line-ending conversions (e.g., via `core.autocrlf`)? – torek Jan 23 '18 at 22:03
  • I've used both unix2dos and dos2unix and neither solved the issue @Philippe – eddhall Jan 24 '18 at 09:26
  • @torek I use OSX normally but the commit was made on my ubuntu machine – eddhall Jan 24 '18 at 09:27
  • If you're looking at the commit on an OS X system with case folding, it *could* be an issue with uppercase vs lowercase file names. On Ubuntu (or Linux in general) files `README` and `readme` are two different files, but on WIndows and OS X these two names normally denote the *same* file. So on a Linux box, you can create both files, with different content. When you then extract that commit on OS X, you get just *one* file, with *one* of the two files' content (whichever one got extracted last). – torek Jan 24 '18 at 19:23
  • I think you're on to something there - looks like the change that was made was an update, there are now 2 folders in the remote repo, same names but one is capitalised! I'll try removing the old one and see if that helps – eddhall Jan 26 '18 at 09:48

1 Answers1

0

As mentioned by @torek, linux views folder/ and Folder/ as 2 different directories, whereas OSX and Windows don't! This resulted in git always thinking the files had been modified!

I removed the duplicate files on my linux instance, committed the changes and it's all fine on OSX now

eddhall
  • 193
  • 17