" ๊นƒ๊ฒฝ๊ณ  the file will have its original line endings in your working directory git add
๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
ํ˜„์—…๊ด‘๊ณ ์ธ/๊ฐ์ข…๊ฟ€ํŒ

๊นƒ๊ฒฝ๊ณ  the file will have its original line endings in your working directory git add

by ๋…๋”˜ 2020. 11. 5.
728x90
๋ฐ˜์‘ํ˜•

๊นƒ์—์„œ ์ข…์ข… ํŒŒ์ผ๋“ค์„ ์Šคํ…Œ์ด์ง€์— ์˜ฌ๋ฆด๋•Œ (add) ์‚ฌ์ง„๊ณผ  ๊ฐ™์€

warning lf will be replaced by crlf in ํŒŒ์ผ๋ช… 

the file will have its original line endings in your working directory ๋ผ๋Š” 

๊ฒฝ๊ณ ๋ฉ”์„ธ์ง€ (warning)๋ฅผ ๋‚˜์˜ค๋Š” ๊ฒƒ์„ ํ™•์ธํ•  ์ˆ˜์žˆ๋‹ค.

์ด๊ฒƒ์˜ ์›์ธ์€ ์œˆ๋„์šฐ์˜ ์ค„๋ฐ”๊ฟˆ ๋ฌธ์ž์™€ ๋ฆฌ๋ˆ…์Šค์˜ ์ค„๋ฐ”๊ฟˆ ๋ฌธ์ž๊ฐ€ ๋‹ค๋ฅด๊ธฐ ๋•Œ๋ฌธ์— ๋ฐœ์ƒํ•œ๋‹ค.

๋ฆฌ๋ˆ…์Šค ์‹œ์Šคํ…œ์—์„œ ๊ฐœํ–‰๋ฌธ์ œ ๋˜๋Š” End of Line (EOL)์„ Line Feed (LF)๋กœ ๋‚˜ํƒ€๋‚ด๋ฉฐ

์œˆ๋„์šฐ ์‹œ์Šคํ…œ์—์„œ๋Š” Carriage Return (CR) ๊ทธ๋ฆฌ๊ณ  Line Feed (LF) ํ•ฉ์ณ CRLF๋กœ ๋‚˜ํƒ€๋‚ธ๋‹ค.

์ฆ‰, ๊นƒ(Git)์˜ ๋ช…๋ น๋“ค์€ ๋ฆฌ๋ˆ…์Šค๋ฅผ ๊ธฐ๋ฐ˜์œผ๋กœ ์ฒ˜๋ฆฌํ•˜๋ฏ€๋กœ ์˜ค์ง Line Feed(LF)์„ ์ฝ”๋“œ๋ฅผ ์ฒ˜๋ฆฌํ•œ๋‹ค.

๊ทธ๋Ÿฌ๋ฏ€๋กœ ์ด ๋ฉ”์„ธ์ง€๋Š” ์šฐ๋ฆฌ๊ฐ€ ์œˆ๋„์šฐ์—์„œ ์ž‘์—…ํ•œ ๋ฌธ์„œ๋“ค์˜ CRLF ๋ฌธ์ž๋ฅผ LF๋ฌธ์ž๋กœ ๋ณ€ํ™˜ํ•ด์„œ ์ปค๋ฐ‹ํ•  ๊ฒƒ์ด๋ผ๋Š” ์˜๋ฏธ์ด๋‹ค. 

 

์–ด๋– ํ•œ ์‚ฌ์šฉ์ž์˜ ์กฐ์น˜๋ฅผ ์š”๊ตฌํ•˜๋Š” ๊ฒƒ์ด ์•„๋‹ˆ๋ฏ€๋กœ ๊ฒฝ๊ณ ๋ณด๋‹ค๋Š” ์•Œ๋ฆผ์„ฑ๋ฉ”์„ธ์ง€๋ผ๊ณ  ์ƒ๊ฐํ•ด๋„ ๋œ๋‹ค.

์‚ฌ์‹ค ์ด ์ •๋„๋กœ ๋„˜์–ด๊ฐ€๋ฉด ๋”ฐ๋กœ ํฐ ๋ฌธ์ œ๊ฐ€ ๋˜์ง€ ์•Š์ง€๋งŒ

์ด๋Ÿฌํ•œ ๊ธฐ๋Šฅ์„ ์‚ฌ์šฉ์„ ํ˜น์‹œ๋‚˜ ์›์น˜ ์•Š์•„ ๋น„ํ™œ์„ฑํ™”๋ฅผ ํ•˜๊ณ ์‹ถ์œผ๋ฉด ๋ฐ‘ ์ฝ”๋“œ๋ฅผ ๋ถ™์—ฌ์ฃผ๋ฉด ๋œ๋‹ค.

$ git config --global core.autocrlf false

ํ•˜์ง€๋งŒ ์œ„์™€ ๊ฐ™์€ ๊ฒฝ์šฐ ์—ฌ๋Ÿฌ ๋ฌธ์ œ๊ฐ€ ๋ฐœ์ƒํ• ์ˆ˜์žˆ์œผ๋ฏ€๋กœ ๋ฐ‘ ์ฝ”๋“œ๋ฅผ ์ž‘์„ฑํ•˜์—ฌ CRLF๋ฅผ LF๋ฌธ์ž๋กœ ๋ณ€ํ™˜ ํ•  ๊ฒƒ์„ ์ถ”์ฒœํ•œ๋‹ค.  

$ git config --global core.autocrlf true

 

Reference 1
https://stackoverflow.com/questions/5834014/lf-will-be-replaced-by-crlf-in-git-what-is-that-and-is-it-important
Reference 2
์ง€์˜ฅ์—์„œ ์˜จ ๋ฌธ์„œ ๊ด€๋ฆฌ์ž: ๊นƒ & ๊นƒํ—ˆ๋ธŒ ์ž…๋ฌธ 
๋ฐ˜์‘ํ˜•