When you open your code in Windows, and run git in WSL bash, you will have a big chance to meet an issue that git status
shows all your file get modified. To fix the issue, run this in WSL bash:
git config --global core.autocrlf true
We get this bug because, we are using git in WSL (Windows Subsystem for Linux), but we are opening files in Windows system. So the line ending is CRLF
, but git thought it’s on Linux so the line should ends with LF
.
So the fix command will tell git to use CRLF
and line ending.