[ACCEPTED]-Git - Ignore certain files contained in specific folders-msysgit

Accepted answer
Score: 15

Just had a similar problem and realized: The 7 files were already added and checked in 6 to git.

How to recognize the difference: Git 5 didn't show the files as "new", but as "modified". This 4 details has cost me quite some time...

If 3 that is the problem, simply "git rm" these 2 files and start over. Suddenly, .gitignore 1 starts to work as expected.

Score: 14

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


That does work for any depth.

Original 12 answer (2009, Git 1.6)

Did you try:


It does 11 work with my msysgit1.6.3 (with a .gitignore file 10 at the root directory of the Git workspace).

Actually 9 the above would only ignore 'x/bin/z.dll', not 'x/y/bin/z.dll'.

Another 8 syntax could be:


But that would only get 7 depth 3, not depth 2!

So if you do not have 6 too many place where *.dll need to be ignored, the 5 simplest solution would still be a local 4 .gitignore file in those 'bin' directories...

Or 3 a collection of directive to cover the main 2 first depths:


and so on, all in one .gitignore 1 file.

Score: 13

I just have /bin in my file and it seems to 3 work. It ignore the whole folder (as opposed 2 to specific files in it)

Here are the complete 1 contents as of now (still evolving).

Score: 4

.gitignore on windows, just does not seem 8 to work. I am using msysgit v 1.7.6 beta, and 7 it just does not work the way it should 6 per the .gitignor man page. Now, if I copy 5 the contents of my .gitignore file to the 4 $GIT_DIR/info/exclude file, inside the repo, things 3 do work.

So, the bummer is that this does 2 not get replicated, but it is better than 1 nothing.

Score: 1

Depending on language you are using, you 7 can choose it from link

For example, If you are 6 using java, you can use gitignore

Also https://www.gitignore.io/ allows you 5 to create gitingore file online, you just 4 need to enter operating system, IDE or programming 3 language and based on it, It will give you 2 gitignore file. Using it you can create 1 gitignore file for your project easily.

Score: 0

*/bin worked for me

I'd think that */bin/ would 1 as well.

More Related questions