Github Desktop | Cannot add [bob] to .gitignore

Hi, First time posting on here.

I’m looking on help with github desktop, Just trying to create a .gitignore on a file “resource/[bob]/” and it seems to not be working but for “db/” it does work, Any suggestions? I can’t change the name of the folder btw.


Anything enclosed in square brackets will be interpreted as range notation, as described in the gitignore pattern format documentation. So [bob] will match a b or o character. If you want to match literal square brackets you need to escape them with backslashes:


Seems to not work, I was looking into pattern format but I have not got that far.

That did not work what should I do now?

Hm, I wonder if that has anything to do with you working on Windows, where the backslash can also be a directory separator? Not sure.

Maybe try using this:


The ? matches any character other than /, if you don’t have any other directories that match (e.g. resource/abobc/) it should work.

I have found out with that info, That did not work but just messing around with it ?bob works!


1 Like