0

I maintain a Git repository of PHP scripts locally on my Windows Vista machine and I uploaded the PHP scripts to a server. Some changes were done on the scripts on the server; only 1 or 2 files were modified.

I downloaded all the scripts back to my Windows machine and now when I run git status it shows ALL FILES (about 2500 of them) as being modified!!

I have the following git config before I uploaded the files to server

core.autocrlf=true

I changed

git config --replace-all --global core.filemode false

same thing, All files still show up as being modified

I have a zip of the old repo and files. Can anyone please let me know how I proceed from here?

ajp15243
  • 7,704
  • 1
  • 32
  • 38
Shanthi
  • 637
  • 2
  • 7
  • 17
  • Are these files in deeply nested folders (which would give them very long path strings)? This is irregardless of the repo root. I'm talking about the absolute filepath string starting with your drive letter. Windows has a hard limit on path string sizes that can mess up Git for Windows. I have had some luck working around this issue by using [Cygwin](http://www.cygwin.com/) and installing/using Git from the Cygwin prompt (so that it doesn't use Windows Git), which is presumably using a more flexible Linux implementation for file path strings. – ajp15243 Jan 02 '14 at 06:42
  • @ajp15243 Nope they are nested at the max 2 directories below and quite short file and directory names.I'm using http://msysgit.github.io/. I have so many repositories in my windows machine, so switching over to http://www.cygwin.com/ is the only solution ? – Shanthi Jan 02 '14 at 06:53
  • @Shanthi If you want to bite the bullet and normalise all the line endings in your files to avoid future headaches, I suggest reviewing the selected answer proposed in this [question](http://stackoverflow.com/questions/1510798/trying-to-fix-line-endings-with-git-filter-branch-but-having-no-luck). – miqh Jan 02 '14 at 07:00
  • @miqid Thanks for the link I tried `# From the root of your repository remove everything from the index git rm --cached -r . # Change the autocrlf setting of the repository (you may want # to use true on windows): git config core.autocrlf input # Re-add all the deleted files to the index # (You should get lots of messages like: # warning: CRLF will be replaced by LF in .) git diff --cached --name-only -z | xargs -0 git add # Commit git commit -m "Fixed crlf issue" ` and then downloaded the changed scripts and then ran the `git status` and all files show as modified. Please help – Shanthi Jan 02 '14 at 08:58
  • What do you get when you do `git diff` – Mohammad AbuShady Jan 02 '14 at 09:48
  • @MohammadAbuShady should I run the git diff before or after downloading the latest scripts from server ? – Shanthi Jan 02 '14 at 09:59
  • I don't know, you tell me, run it whenever `git status` shows loads of files being modified – Mohammad AbuShady Jan 02 '14 at 10:07
  • @MohammadAbuShady git diff tells me WARNING: terminal is not fully functional – Shanthi Jan 02 '14 at 10:20
  • @Shanthi [This question](http://stackoverflow.com/q/7949956/1883647) deals with that issue, you may find something there that helps. Also, just to note, it sounds like you thought switching to Cygwin Git would mean re-cloning your repos or something. You won't have to do this, assuming you're using a modestly recent version of Git for both. Git for Windows (msysgit) and Cygwin's Git can be fluidly swapped out as desired, your repos are not tied to one program or the other. – ajp15243 Jan 02 '14 at 14:50

1 Answers1

0

Run git diff.

If you don't see any actual code changes, than you can assume this is caused by file attribute changes (maybe mtime?). At which point, you can run git checkout -f, which will undo all the nothing "changes" that occurred to these files.

DO NOT run git checkout -f if git diff shows you actual changes!

jonathan3692bf
  • 1,398
  • 1
  • 12
  • 14