1

I'm working on the trunk of a project locally and need to checkout a remote branch. My working copy is fully up-to-date, and i run

git checkout -b RC1 origin/RC1

After that I run

git status

And it tells me I have about 30 files that are modified and untagged. I open a visual interface to view the changes in the files and they are 100% the same. When I run

git diff

I get:

The file will have its original line endings in your working directory. warning: CRLF will be replaced by LF in src/private/library/arialunicid0-chinese->traditional.php.

My question is why are all of these files considered to be modified? Shouldn't my branch be clean, with no changes if I just checked it out?

Dan Ramos
  • 1,092
  • 2
  • 19
  • 35

1 Answers1

2

To quote the git checkout manpage,

git checkout <branch>
Local modifications to the files in the working tree are kept, so that they can be committed to the <branch>.

So no, the working copy will not always be clean after a checkout; your files were probably modified before the checkout, or your autocrlf settings are messing stuff up for you. It's generally less of a headache to turn off EOL-conversion in Git and instead make sure that all developers use editors which can handle all EOLs -- and agreeing on one kind of line ending (e.g. unix-style, LF only).

Nevik Rehnel
  • 49,633
  • 6
  • 60
  • 50
  • 1
    Ahh it was the EOL-conversion by git that was the issue. I went ahead and implemented [this solution](http://stackoverflow.com/questions/9933004/best-way-to-disable-git-end-of-line-normalization-crlf-to-lf-across-all-clones) and it worked. Thanks for the help! – Dan Ramos Feb 06 '13 at 20:02