本文介绍了当我保存在Windows 7中时,git diff显示所有带有^ M的行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用Ubuntu上传了一个版本库到github。



我下载到windows 7并使用msysgit。当我在Windows中保存一些文件没有任何改变。

当我做git状态时,它们被列为已修改。



当我执行git diff时,所有行末都有^ M。



这是什么^ M和我怎么能忽略这个?



预先感谢。



更新



我在.gitconfig中使用了autocrlf = false,因为我想保留lf而不是auto或crlf。

解决方案

尝试在git config中使用选项。

  git config core.autocrlf true 


I used Ubuntu to upload a repository to github.

I downloaded to windows 7 and using msysgit. When I saved some files in Windows without any changes.

When I do git status, they are listed as modified.

When I do git diff, all the line has ^M at the end.

What is this ^M and how can I ignore this?

Thanks in advance.

UPDATE

I have autocrlf = false in .gitconfig, because I want to keep lf rather than auto or crlf.

解决方案

Try to use autocrlf option in git config.

git config core.autocrlf true

这篇关于当我保存在Windows 7中时,git diff显示所有带有^ M的行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 02:26