gpt4 book ai didi

git - 有没有办法强制 git add 忽略行结束问题?

转载 作者:太空狗 更新时间:2023-10-29 14:18:27 25 4
gpt4 key购买 nike

我有一个巨大的目录,我需要将其导入到 git 中,而且我正在忍受行结束管理的痛苦。

最初我只需要将所有内容都放入 repo 中,没有时间处理行尾。为此,我添加了一个带有 * -text.gitattributes 文件,但这并没有解决问题,因为有很多子目录包含带有自己的 的模块>.gitattributes 文件和 text=auto

有没有什么办法可以毫不费力地获取存储库中的所有文件?

最佳答案

gitattributes documentation状态:

When deciding what attributes are assigned to a path, Git consults:

  • $GIT_DIR/info/attributes file (which has the highest precedence),
  • .gitattributes file in the same directory as the path in question, and its parent directories up to the toplevel of the work tree (the further the directory that contains .gitattributes is from the path in question, the lower its precedence).
  • Finally global and system-wide files are considered (they have the lowest precedence).

If you wish to affect only a single repository (i.e., to assign attributes to files that are particular to one user’s workflow for that repository), then attributes should be placed in the $GIT_DIR/info/attributes file.

因此,请尝试在 $GIT_DIR/info/attributes 中设置您的 * -text 指令,至少对于您的初始添加和提交。

关于git - 有没有办法强制 git add 忽略行结束问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32846232/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com