1

I am getting a weird issue with Git repository not being clean, this is right after cloning it. I tried several different workarounds and no luck.

Note that I don't think I can't just copy all the file to another directory and copy back with a new git repo because we want to keep the git commit history.

  • Tried to git add . from root directory and recommit but the files won't add.
  • There's not .gitignore file in the root directory of the repo...I also checked /Users/user directory also and there's no extra .gitignore file
  • Checked within the directory where files are not committing for extra .git directory but there was none
  • Tried git checkout -- <file> and reset file but does not work
  • Tried git add --force and it does not work

Was wondering if anyone else had any ideas?

Update 1

Few things I have noticed

  • The committed file on GitHub have 257 lines, but after I do a fresh pull it locally, the local version only have 89 lines.
  • If I do git rm --cached to remove the file, I am able to delete the unstaged files and commit those, but I loses the change difference of those files.
YTKColumba
  • 25
  • 1
  • 8
  • what does ```git status``` say? – eftshift0 Apr 04 '17 at 15:37
  • can you paste the error you get ? – Thanga Apr 04 '17 at 15:39
  • @Edmundo ```git status``` just says i have changes not staged for commit – YTKColumba Apr 04 '17 at 15:52
  • @Thanga i am not getting an errors, the git commands are just not really doing anything, like ```git add .``` doesn't do anything to add the files – YTKColumba Apr 04 '17 at 15:52
  • Then git add should add the files that you have with pending changes. Can you make sure you are running ```git add .``` from the _root_ of the repository? – eftshift0 Apr 04 '17 at 15:53
  • @Edmundo i am running from the root of the repo, ```git add .``` doesn't do anything https://pastebin.com/sjpK3yBV – YTKColumba Apr 04 '17 at 16:00
  • This looks an awful lot like the usual CRLF vs LF-only *or* case-folding-file-names problem. For an example of the latter, see http://stackoverflow.com/q/38248208/1256452 – torek Apr 04 '17 at 16:59
  • @torek i don't think it is, i did a ```git diff``` of the file and it doesn't seem like a line feed issue – YTKColumba Apr 04 '17 at 18:28
  • That's why I sugggested the case-folded-file-names thing as well. For instance Linux has both foo.h and FOO.H files; if you check out such a repository on Windows or Mac, using a default case-folding file *system*, the work-tree file is just one of those two names, so that the *other* file is "modified". You mentioned `/Users` which suggests MacOS. – torek Apr 04 '17 at 19:03
  • Is your os x file system set up as case **sensitive** or case **insensitive**? – Lasse V. Karlsen Apr 04 '17 at 19:04
  • @LasseV.Karlsen it should be case sensitive – YTKColumba Apr 04 '17 at 20:21
  • @torek i get the same result if i pull to a linux system though – YTKColumba Apr 04 '17 at 20:22
  • Why should it be case sensitive? The default for os x file system is case insensitive. Did you check or do you assume? – Lasse V. Karlsen Apr 04 '17 at 20:24
  • Try issuing a `git ls-files` and see if you have multiples of the files that are shown as unstaged, with different case combinations. – Lasse V. Karlsen Apr 04 '17 at 20:25
  • @LasseV.Karlsen sorry, it is case insensitive, also ```git ls-files``` provided a huge list, is there certain thing i should be looking for? – YTKColumba Apr 04 '17 at 21:56
  • Yes, try to find the filenames that are causing problems, see if they exist more than once just with a casing difference, such as `File1.txt` vs `file1.txt` (F vs. f) – Lasse V. Karlsen Apr 05 '17 at 06:38
  • @LasseV.Karlsen ok, so i looked through all the files with ```git ls-files``` and it seem like there are files with case issues. Let me see if I can fix this... – YTKColumba Apr 05 '17 at 21:30

0 Answers0