Git - Ignore specific files contained in specific folders

I am using msysgit and have a project tree that contains many bin / folders in the tree. Using the .gitignore file in the root of the project, I need to ignore all the DLL files that are inside the recycle bin / folder anywhere in the project tree. I tried "bin / *. Dll", but it does not work, I assume that it only works with bin / folder in the root of the project.

+18
git msysgit
Jun 09 '09 at 17:35
source share
5 answers

I had a similar problem and realized: the files are already added and marked in git.

How to recognize the difference: Git did not display the files as โ€œnewโ€, but as โ€œchangedโ€. These details cost me quite a while ...

If this is a problem, simply โ€œgit rmโ€ these files and start over. Suddenly .gitignore starts to work as expected.

+14
Sep 05 '10 at 13:22
source share

I only have /bin in my file and it seems to work. It ignores the entire folder (unlike certain files in it)

Here is the full content at the moment (still developing).

 .svn* obj/ bin/ *.suo *.user Log/ log/ *.db 
+13
Jun 11 '09 at 23:25
source share

August 2016 Update (seven years later, Git 2.9.3 / Git 2.10)

 **/bin/*.dll 

It works for any depth.




Original answer (2009, Git 1.6)

Have you tried:

 **/bin/*.dll 

It works with my msysgit1.6.3 (with the .gitignore file in the root directory of the Git workspace).

Actually, the above will ignore " x/bin/z.dll ", not " x/y/bin/z.dll ".

Another syntax could be:

 **/*/bin/*.dll 

But it will only be depth 3, not depth 2!

So, if you have too much space where you need to ignore * .dll, the simplest solution will still be the local .gitignore file in these "bin" directories ...

Or a set of directives to cover the main first depths:

 bin/*.dll **/bin/*.dll **/*/bin/*.dll **/**/*/bin/*.dll 

etc., all in one .gitignore file.

+9
Jun 09 '09 at 17:47
source share

.gitignore on windows doesn't seem to work. I am using msysgit v 1.7.6 beta and it just does not work as it should on the .gitignor man page. Now, if I copy the contents of my .gitignore file to the $ GIT_DIR / info / exclude file, everything will work inside the repo.

So bummer: this is not replicated, but better than nothing.

+4
Sep 02 '11 at 19:06
source share

* / bin worked for me

I would have thought that * / bin / would also be.

0
Apr 2 2018-10-02T00:
source share



All Articles