Search code examples
gitconsolegitignore

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


I found that some of the github projects contain files that was mentioned in gitignore file. (I think they are forcefully added files.)
So once I clone the project, that's working well.
But once clone, make new repository, and push the code, then clone again, code is not running. I had to find all the files in my eye, difference between default project and new repository, and then forcefully push the files mentioned in gitignore file.

My question is how can I automatically get the list of all files on project mentioned in .gitignore?

I have tested with https://github.com/dashpay/dash/.

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

For the above project the result should be

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

UPDATE: git check-ignore ./* is showing all the ignored files once changed.
git status --ignored same.


Solution

  • You may also try a simpler

    git status --ignored

       --ignored
           Show ignored files as well.
    

    EDIT: to get a list of file ignored by .gitignore but forcely added to the repository you should try:

    git ls-files -i --exclude-standard