I've recently been curious on how to ignore certain extensions, but with exactly one extra character. One example of where this is relevant is in vim if the .swp
already exists another extension is used, like .swo
, .swn
, etc. So for this pattern I'd be interested in *.sp
plus exactly one character.
I've thought about using *.sp*
to match this pattern however, I feel like there could be edge cases where this collects something unintended so I would prefer a more focused solution.
So is there a way in a gitignore file to specific any extra character to satisfy the patter above?
Based on this link: https://git-scm.com/book/en/v2/Git-Basics-Recording-Changes-to-the-Repository#Ignoring-Files
You can use ?
to mean one character, so you can do: *.sp?
and to be more specific, if you have a list of possible value for this one caractere then you can use: *.sp[abd]
this will ignore .spa, .spb, .spd