CS FundamentalsHardProduct-company placement · Git

A developer on Windows opens a repository created on Linux, edits one line of a file, and git diff shows every line changed. What is the most likely cause and fix?

  1. A. The file's encoding was changed by the editor; re-save the file as UTF-16
  2. B. Git's rename detection failed on Windows; record the change with git mv
  3. C. LF line endings became CRLF; normalise them via .gitattributes (* text=auto)
  4. D. Trailing whitespace on each line was trimmed; review the change with git blame -w

Correct answer: C. LF line endings became CRLF; normalise them via .gitattributes (* text=auto)

A line-ending conversion rewrites every line. Declaring text files in .gitattributes (or setting core.autocrlf) makes Git store LF in the repository and convert only in the working tree, so diffs show real changes.

More Software Engineering, Git and Cloud Basics questions

Exams that ask this topic