【问题标题】:Ignore text=auto in .gitattributes file忽略 .gitattributes 文件中的 text=auto
【发布时间】:2015-03-24 14:28:14
【问题描述】:

我检查了一个分支foo,现在我想切换到分支bar

error: Your local changes to the following files would be overwritten by checkout:
<300 files follow>

某人在foo 上有一个.gitattributes 文件,其中包括

text=auto

所有“更改”都是换行符。

我可以删除文件,切换分支,然后重新添加。

rm .gitattributes
git checkout bar
git checkout .gitattributes

这是最好(最快/最少打字)的方式吗?

编辑:要清楚,我只想切换分支。我只是在阅读回购。除了工作树之外,我不想更改任何内容。但我做不到。

【问题讨论】:

  • 存储,然后使用 -Xignore-eol 或其他任何方式应用更改?

标签: git gitattributes


【解决方案1】:

我只想切换分支。我只是在阅读 repo。

然后删除 .gitattributes 确实是一种可能的解决方案,前提是您不要尝试在 bar 上再次结帐 foo(或者 .gitattributes 会再次出现)

另一种选择是简单地clone the repo directly at the bar branch,创建一个单独的工作树。

【讨论】:

  • @PaulDraper 好的,我已经相应地重写了答案。
猜你喜欢
  • 1970-01-01
  • 2014-02-23
  • 2015-09-07
  • 2015-06-08
  • 2018-03-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多