Which command configures Git to automatically handle line endings across platforms?

Dive into the Architect Journey – Development Lifecycle and Deployment Exam. Prep with tailored flashcards, explore multiple choice questions with detailed explanations, and enhance your readiness for the test!

Multiple Choice

Which command configures Git to automatically handle line endings across platforms?

Explanation:
Automatic handling of line endings across platforms is governed by Git’s line-ending normalization setting, core.autocrlf. When this is set to true globally, Git converts CRLF to LF when you commit, and converts LF back to CRLF when you check out, so the repository stores consistent LF endings while working copies on Windows use CRLF. This keeps files from diverging due to platform-specific endings and reduces spurious diffs and conflicts. Using the global option ensures the behavior applies to all repositories for your user, which is why the command with --global and core.autocrlf true is the best fit. If you omit --global, the setting would apply only to a single repository. Setting the value to false would disable automatic conversion, potentially causing mixed endings across platforms, and a non-existent option like line_ending is not a valid Git configuration.

Automatic handling of line endings across platforms is governed by Git’s line-ending normalization setting, core.autocrlf. When this is set to true globally, Git converts CRLF to LF when you commit, and converts LF back to CRLF when you check out, so the repository stores consistent LF endings while working copies on Windows use CRLF. This keeps files from diverging due to platform-specific endings and reduces spurious diffs and conflicts.

Using the global option ensures the behavior applies to all repositories for your user, which is why the command with --global and core.autocrlf true is the best fit. If you omit --global, the setting would apply only to a single repository. Setting the value to false would disable automatic conversion, potentially causing mixed endings across platforms, and a non-existent option like line_ending is not a valid Git configuration.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy