Git autocrlf setting for mac and windows
Asked Answered
H

1

7

Our team has people working on macs and windows. So far we had our git automatic line ending set to true (on OSX) and input (on Windows). It works nice, unless there is a merge conflict. In this case both SourceTree and GitKraken mess up the merge on Windows since they see all the lines ending with LF as one line.

Should all of us use the same value of core.autocrlf (in that case which one?) or are there some fixes for specific applications?

Note: Currently we do manual merging when line endings get messed up, but this is painful. Also setting core.autocrlf to false is not an option as wrong line endings on config files crash build on linux.

Hawser answered 23/6, 2017 at 11:22 Comment(3)
Possible duplicate of Why should I use core.autocrlf=true in Git?Diantha
and also https://mcmap.net/q/11253/-what-39-s-the-strategy-for-handling-crlf-carriage-return-line-feed-with-gitDiantha
Does this answer your question? What's the strategy for handling CRLF (carriage return, line feed) with Git?Sinciput
M
7

"autocrlf" should be "input" on Unix (Mac/Linux) while "true" on Windows. This is very well-explained on Git's official document under the "Formatting and Whitespacing" section in:

https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration

Mcmurry answered 28/11, 2021 at 1:7 Comment(1)
Thank you for the response. It was already answered in the comments.Hawser

© 2022 - 2024 — McMap. All rights reserved.