GIT中的结束问题 [英] Line Ending Problems in GIT

查看:130
本文介绍了GIT中的结束问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我做了一系列更改,GitTower或GIT总的来说告诉我:

  410个文件已更改,已添加68615行,已删除70606行

这是完全不正确的,除了文件已更改的编号。



我编辑了至多20至30行代码在每个文件中,但是对于编辑的每个文件,GIT说我替换了整个文件的内容。



我假设这是因为行结尾来自不同的操作系统?我通常没有这个问题,这是我第一次从事公共回购工作。



我环顾了一些导致我尝试的其他答案并通过以下方式发现我的当前配置:

  git config core.autocrlf 

运行它时不会返回任何结果。



所以我假设我需要设置它? GitHub建议Mac用户使用输入法,这将确保我的文件不会显示整个文件已被更改?

另外,有没有办法修复提交我提到,所以它只显示正确的行数改变?

解决方案

当然,你应该设置 core.autocrlf Git-documentation



<为了解决这个问题,你可能需要首先恢复你的提交。 恢复到之前的Git提交
然后,配置它并再次提交。


I'm working on a Mac and pulling a repo from GitHub.

I've made a series of changes and GitTower or GIT in general is telling me:

410 files changed, 68615 lines added, 70606 lines deleted

This is completely incorrect other than the files changed number.

I edited at most 20 to 30 lines of code in each file, yet for each file edited GIT says I replaced the entire contents of the file.

I'm assuming this is because the line endings are from a different OS? I normally don't have this issue, this is the first time I'm working on a public repo.

I looked around at some other answers which led me to try and discover my current config via:

git config core.autocrlf

This returns nothing when I run it.

So I'm assuming I need to set it? GitHub recommends "input" for Mac users, will this make sure that my files don't show the entire file was changed?

Also, is there a way to fix the commit I mentioned so that it only shows the correct number of lines changed?

解决方案

Surely, you should set the core.autocrlf. Git-documentation

And to fix the problem, you may need to revert your commit first. Revert to previous Git commit Then, configure it and make a commit again.

这篇关于GIT中的结束问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆