简体   繁体   English

如何使git在临时文件中使用CRLF?

[英]How do you make git use CRLF in temporary files?

In Windows 7, git would open notepad, and it worked fine, as the temporary files that git created during eg. 在Windows 7中,git可以打开记事本,并且可以很好地工作,因为git是在eg中创建的临时文件。 git commit or git rebase -i contained CRLF. git commitgit rebase -i包含CRLF。

I am currently using the Windows 10 preview, and have set core.editor to notepad. 我目前正在使用Windows 10预览版,并将core.editor设置为记事本。 However, the temporary files are being created with LF instead of CRLF, which notepad does not support. 但是,临时文件是用LF而不是CRLF创建的,记事本不支持。

On both platforms, I am using the Git Shell that GitHub for Windows gives you, set to Bash. 在这两个平台上,我都使用Windows的GitHub提供的Git Shell(设置为Bash)。

How do I make git use CRLF in temporary files, like it did on my Windows 7? 像Windows 7一样,如何使git在临时文件中使用CRLF?

Ah, found the answer: GitHub for Windows includes a utility called gitpad which converts the file to CRLF and then calls notepad. 啊,找到了答案:适用于Windows的GitHub包含一个名为gitpad的实用程序,它将文件转换为CRLF,然后调用记事本。 This had been set as the EDITOR variable on my Windows 7 system, so it all worked transparently. 在我的Windows 7系统上已将其设置为EDITOR变量,因此它们都透明地工作。 Setting core.editor to gitpad on my Windows 10 system solved the problem. 在Windows 10系统上将core.editor设置为gitpad解决了该问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM