0

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.

artgb
  • 3,177
  • 6
  • 19
  • 36
  • @CarlGroner, above code is showing `Your branch is up-to-date with origin/master nothing to commit, working tree clean`. Not getting the files ignored. – artgb Oct 19 '17 at 00:32

2 Answers2

1

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

Yusef Maali
  • 2,201
  • 2
  • 23
  • 29
  • Did you tested with the url in my question? Your code is not showing anything after cloning. – artgb Oct 19 '17 at 01:02
  • After cloning you can't have ignored files, this is by definition. – Yusef Maali Oct 19 '17 at 01:03
  • Please see my question again, I want to find forcefully added files that was mentioned in gitignore file, – artgb Oct 19 '17 at 01:08
  • you welcome. For more details you can give a look here https://stackoverflow.com/questions/9320218/how-to-list-files-ignored-by-git-that-are-currently-staged-or-committed and here https://stackoverflow.com/questions/466764/git-command-to-show-which-specific-files-are-ignored-by-gitignore – Yusef Maali Oct 19 '17 at 01:21
0

You can use git check-ignore and provide a wildcard path to match any file in the current directory or any of its subdirectories:

find . -type f  | git check-ignore --stdin
dave
  • 62,300
  • 5
  • 72
  • 93
  • I can't get any result from above project. – artgb Oct 19 '17 at 00:07
  • edited, it wasn't recursive like I thought, this should work – dave Oct 19 '17 at 00:13
  • for the above code the result is `./build-aux.DS_Store , ./depends/.DS_Store, ./src/.DS_Store, ./src/secp256k1/.DS_Store`, It's only showing `.DS_Store`, But I can find that depends/patches are there. – artgb Oct 19 '17 at 00:16
  • Please test with this url https://github.com/dashpay/dash/, git clone and git cd dash, find . -type f | git check-ignore --stdin – artgb Oct 19 '17 at 00:19