Solve the problem of VSCode reporting Delete `␍`eslint (prettier/prettier)

git newline configuration under Windows

Excerpt

Optimal configuration In order to maximize compatibility with macOS and Linux, it is necessary to: Convert to LF when submitting, not convert when checking out Refuse to submit files containing mixed line breaks Convert CRLF to LF in batches If you accidentally...


git newline configuration under Windows

insert image description here

optimal configuration

In order to maximize compatibility with macOS and Linux, you need:

  1. Convert to LF on commit, not on checkout
  2. Refuse to submit files containing mixed newlines
git config --global core.autocrlf input
git config --global core.safecrlf true

Batch convert CRLF to LF

If you accidentally write the newline character of some text as CRLF under Windows, you can use the dos2unix tool to restore it back to LF

Execute under Cmder or Cywin:

find . -type f|xargs dos2unix

IDE configuration

Attachment: autocrlf parameter description

# 提交时转换为LF,检出时转换为CRLF
git config --global core.autocrlf true

# 提交时转换为LF,检出时不转换
git config --global core.autocrlf input

# 提交检出均不转换
git config --global core.autocrlf false

Attachment: safecrlf parameter description

# 拒绝提交包含混合换行符的文件
git config --global core.safecrlf true

# 允许提交包含混合换行符的文件
git config --global core.safecrlf false

# 提交包含混合换行符的文件时给出警告
git config --global core.safecrlf warn

Guess you like

Origin blog.csdn.net/zqd_java/article/details/129530707