Github 项目在 .gitignore 文件中查找所有文件 |强行添加的文件

Github project find all files in .gitingore file | Forcefully added files

我发现一些 github 项目包含 gitignore 文件中提到的文件。 (I think they are forcefully added files.)
因此,一旦我克隆了该项目,它就运行良好。
但是一旦克隆,创建新的存储库,并推送代码,然后再次克隆, 代码不是 运行。 只好把我眼中的文件都找出来,默认项目和新仓库的区别,然后强行push gitignore文件中提到的文件。

我的问题是如何自动获取 .gitignore 中提到的项目中所有文件的列表?

我用 https://github.com/dashpay/dash/ 测试过。

git clone https://github.com/dashpay/dash
cd dash
//find all files

对于上述项目,结果应该是

   depends/patches
   src/secp256k1/build-aux/m4/ax_prog_cc_for_build.m4
                             /bitcoin_secp.m4
   build-aux/m4

更新: git check-ignore ./* 显示所有更改后忽略的文件。
git status --ignored 一样。

您可以使用 git check-ignore 并提供一个通配符路径来匹配当前目录或其任何子目录中的任何文件:

find . -type f  | git check-ignore --stdin

你也可以试试更简单的

git status --ignored

   --ignored
       Show ignored files as well.

编辑: 要获取 .gitignore 忽略但强制添加到存储库的文件列表,您应该尝试:

git ls-files -i --exclude-standard