I have git tracked files problem
all files that have a .php extension, but those .php_back .php072021, etc. I do not want
here is terminal command that work
find .|grep -e “.php$”
But in .gitignore file this regex pattern do not work.
Any help, please.
This question should probably be in the ‘Git’ category.
In your .gitignore file, you could list the extensions using a wildcard.
For example, your gitignote file could look like:
This will exclude all files that end with these extensions.
Hope that helps.
this cannot help because mutated extensions appear dynamically.
For example test.php1 test.php2 test.php555
That’s why I’m looking for a solution with regex in gitignore.
Sorry - I understand now.
Are you able to dynamically generate a double extension?
For example, you could use index.php_back.phpD.
In this case, the wildcard would work because you could ignore all ‘phpD’.
This also might help with running the script as otherwise, your PHP parser would need to know each extension to use for PHP.
*[.php, .js, .bin]*
!*[.php, .js, .bin]
This works with multiple file ext. And this is not actually regex. gitignore regex. :-