【问题标题】:github show differences for entire filegithub显示整个文件的差异
【发布时间】:2017-01-09 04:35:25
【问题描述】:

我做了一些小改动,但 github 显示了整个文件的差异。我怀疑这是由缩进或 default_line_ending 引起的。

奇怪为什么会发生这种情况,我的项目中已经有了 .editconfig。这是设置。我正在使用 sublime text 3。

root = true
[*]

# Change these settings to your own preference
indent_style = space
indent_size = 4
charset = utf-8
max_line_length = 120

# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.md]
trim_trailing_whitespace = false

错误看起来像这样

【问题讨论】:

  • 是的,这很可能是由加衬结尾引起的。也许您的 Git 在签入/签出期间正在更改(或不更改)行尾。或者,它可能是您的文本编辑器。

标签: git github sublimetext3


【解决方案1】:
  1. 检查你是否安装了EditorConfig,并确认你在Sublime Text的属性中启用了show_line_endings

  2. 检查autocrlf 文件中的autocrlf 属性。

  3. 如果您想忽略 Github 差异中的空白更改,请将 ?w=1 添加到 URL 中。

【讨论】:

  • 我需要在 sublime 中安装 EditorConfig 吗?我认为项目中一个名为 .editorconfig 的文件就足够了吗?我看到更改反映的是没有将 EditorConfig 作为包安装。
  • 我在 .gitconfig 中有autocrlf = false
  • 是的,SublimeText 本身不支持它。您的默认设置可能与 .editorconfig 中的设置相似。 .editorconfig 中的 eol 设置是什么?
  • lf。我在上面发布了我的 .editorconfig 的 sn-p。
  • 尝试在您的.gitconfig 中添加core.eol = lf
猜你喜欢
  • 2021-01-25
  • 2018-12-10
  • 1970-01-01
  • 1970-01-01
  • 2012-07-13
  • 1970-01-01
  • 2021-06-23
  • 1970-01-01
  • 2015-08-10
相关资源
最近更新 更多