gpt4 book ai didi

git - 添加 *,但 sibling 被忽略

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

我在目录中进行了一系列更新并想添加它们,但它们位于我的 .gitignore 中的目录旁边。 git add 不应该只是忽略而不是提示吗?

我怎样才能添加所有内容并跳过被忽略的内容?

$ git add assets/*
The following paths are ignored by one of your .gitignore files:
assets/avatars
Use -f if you really want to add them.
fatal: no files added

最佳答案

根据 documentation--ignore-errors 标志只会让命令按照您的意愿工作。

If some files could not be added because of errors indexing them, do not abort the operation, but continue adding the others. The command shall still exit with non-zero status. The configuration variable add.ignoreErrors can be set to true to make this the default behaviour.

更新:

这在这种情况下不起作用,我猜是因为 assets/* 参数被 shell 扩展了,所以 git add 接收到的实际参数是文件和目录的扩展列表,因此失败是明确的。

我已经尝试过这个命令并取得了很好的效果:

$ git add assets

即使没有选项 --ignore-errors 它也能工作,因为它不会尝试在 assets 下添加被忽略的目录。

关于git - 添加 *,但 sibling 被忽略,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31613195/

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