0

I have a web project (php, javascript) which I developed in Windows 8 OS and is in git (bit bucket) repository. Now I am switched to ubuntu 13.04 (dual boot) and using same directory for development (allocating htdocs folder in httpd.conf in lampp) rather than creating new directory. Now I have created another SSH key, added it. But if I use 'git status' it is showing I have to add, commit and push whole project files (in modified state) though it is not as these files are already in the git repo that I did from windows. I am confused. Any one can please help me?

rafi
  • 1,493
  • 3
  • 31
  • 43
  • 5
    Have you checked your line endings settings? It's the most common issue in situations like yours. – Danstahr Jul 15 '13 at 14:39
  • @Danstahr ---- cannot understand.... what is that please? – rafi Jul 15 '13 at 14:44
  • @rafi_ccj: When you say "same directory for development", do you mean that Windows and Linux/Ubuntu access the same folders on the hard disk? – Aaron Digulla Jul 15 '13 at 15:01
  • @Danstahr yes i did mean that.... – rafi Jul 15 '13 at 15:02
  • Possible duplicate of [git replacing LF with CRLF](http://stackoverflow.com/questions/1967370/git-replacing-lf-with-crlf/1967986#1967986)? –  Jul 16 '13 at 05:07

1 Answers1

2

You will want to read this article: https://help.github.com/articles/dealing-with-line-endings

Background: Windows uses a different line ending character than Unix and Mac. This is a constant source of grief and pain for cross platform software development. Sometimes, git "fixes" the line endings. This can be configured using the instructions in the above article. Git will then know that changes in the line endings don't mean that the file has changed.

Sometimes, your IDE notices "oh, the line endings are wrong for this platform" and fixes them. Since this happens without Git knowing, it will see "someone changed a lot of files".

A good way to determine what is going on is to use a powerful diff tool like kdiff3. It will tell you things like "Text files are identical except for line endings" or you can see the line mode DOS vs. Unix near the file name when you compare files. See this question how to configure Git to use kdiff3: Using kdiff3 to edit diffs with git

Community
  • 1
  • 1
Aaron Digulla
  • 321,842
  • 108
  • 597
  • 820
  • thanks a lot!!!! you are the person who have helped me in having relief!!!! (thumbs up) – rafi Jul 15 '13 at 15:45
  • 1
    in your situation (and possibly in every situation) i would suggest to set core.autocrlf to false. this leaves your files as-is and git will be happy if all other tools leave them as-is as well. and because you do not transcode your file when rebooting this is "the right setting" imho. – mnagel Jul 15 '13 at 16:24
  • @mnagel: can you tell me pls, where to do that core.autocrlf to false? – rafi Jul 16 '13 at 07:20