eol - proper autocrlf setting for git -
we use sourcetree client. handles various line endings ok, diff tool uses not. sees lines ending in lf 1 line.
as result, keep source in our repository crlf.
i'm looking @ installing git client. can't find correct setting text or autocrlf. seems want "normalize" file on check in lf.
i want convert crlf on checkout; , either convert crlf on checkin; or nothing on checkin;
the best can find far -text: nothing on checkin or checkout;
is there hope?
thanks, brad.
git's native end-of-line settings lf, , i'm not aware of way alter behavior aside recompiling source. however, can force checkouts use crlf, requires creation of .gitattributes
file. example:
# force c# source files checked out using crlf line endings, # ignoring "core.eol" setting. *.cs eol=crlf # don't apply crlf conversion pdf files, regardless of # user settings including "core.autocrlf". *.pdf -text # other files subjected usual algorithm determine # whether file binary file or text file, respecting # "core.eol" files detected text files. # "core.autocrlf", if set, force conversion to/from crlf # automatically necessary text files. * text=auto
note if created new file lf line endings (e.g. using linux, cygwin, or application such notepad++ defaults lf line endings), warning when adding file repository if matches pattern in .gitattributes
file eol=crlf
used:
warning: lf replaced crlf in example.cs. file have original line endings in working directory.
of course, if later pull new changes, original lf line endings no longer present.
here's list of interactions between various eol/text settings:
.gitattributes
fileeol=...
- possible values
lf
,crlf
. - files specified treated text files , checked out specified line endings.
- ignores
core.eol
,core.autocrlf
.
- possible values
text
- files specified treated text files.
- respects
core.eol
,core.autocrlf
.
text=auto
- files specified subjected automatic detection determine whether text or binary files.
- respects
core.eol
,core.autocrlf
text files. - ignores
core.eol
,core.autocrlf
binary files.
-text
- files specified treated binary files.
- ignores
core.eol
,core.autocrlf
since don't apply binary files.
core.autocrlf
configuration settinginput
: text files checked in undergo conversion crlf native lf.true
: text files checked in/out undergo crlf conversion.- may overridden
eol=...
rule applied files in.gitattributes
.
core.eol
configuration settingnative
(default): text files checked out have native line endings (crlf on windows, lf elsewhere)lf
: text files checked out have lf line endingscrlf
: text files checked out have crlf line endings- if
core.autocrlf
settrue
, setting ignored. - may overridden
eol=...
rule applied files in.gitattributes
.
Comments
Post a Comment