possible duplicate:
git replacing lf crlf
when create new rails application i'm seeing warning in git lf replacement. git init git add .
and boom! see pop files. keep going , build application , disappears after many changes files.
example:
the file have original line endings in working directory. warning: lf replaced crlf in gemfile.
the file have original line endings in working directory. warning: lf replaced crlf in gemfile.lock.
the file have original line endings in working directory. warning: lf replaced crlf in readme.
what's difference between lf , crlf?
should concerned in long run or ignore , keep going do?
in unix systems end of line represented line feed (lf). in windows line represented carriage return (cr) , line feed (lf) (crlf). when code git uploaded unix system have lf.
if want turn warning off, type in git command line
git config core.autocrlf true
if want make intelligent decision how git should handle this, read documentation
here snippet
formatting , whitespace
formatting , whitespace issues of more frustrating , subtle problems many developers encounter when collaborating, cross-platform. it’s easy patches or other collaborated work introduce subtle whitespace changes because editors silently introduce them, , if files ever touch windows system, line endings might replaced. git has few configuration options these issues.
core.autocrlf
if you’re programming on windows , working people not (or vice-versa), you’ll run line-ending issues @ point. because windows uses both carriage-return character , linefeed character newlines in files, whereas mac , linux systems use linefeed character. subtle incredibly annoying fact of cross-platform work; many editors on windows silently replace existing lf-style line endings crlf, or insert both line-ending characters when user hits enter key.
git can handle auto-converting crlf line endings lf when add file index, , vice versa when checks out code onto filesystem. can turn on functionality core.autocrlf setting. if you’re on windows machine, set true – converts lf endings crlf when check out code:
$ git config --global core.autocrlf true
if you’re on linux or mac system uses lf line endings, don’t want git automatically convert them when check out files; however, if file crlf endings accidentally gets introduced, may want git fix it. can tell git convert crlf lf on commit not other way around setting core.autocrlf input:
$ git config --global core.autocrlf input
this setup should leave crlf endings in windows checkouts, lf endings on mac , linux systems , in repository.
if you’re windows programmer doing windows-only project, can turn off functionality, recording carriage returns in repository setting config value false:
$ git config --global core.autocrlf false
Comments
Post a Comment