Extended regular expressions (ERE) for .gitignore

As illustrated here and detailed in “this question“, the function fnmatch() is involved to interpret glob patterns, which means regular expressions are not supported. This is what gitignore man page mentions: Otherwise, git treats the pattern as a shell glob suitable for consumption by fnmatch(3) with the FNM_PATHNAME flag: wildcards in the pattern will not … Read more

working with .git/info/exclude too late

To remove a file that you have added but not committed, use a command like this: git rm –cached file.to.remove This will remove the file from the index, but not touch the file on disk. To remove a file (or files) from the most recent commit, use the above git rm –cached command followed by … Read more

Git Ignores and Maven targets

The .gitignore file in the root directory does apply to all subdirectories. Mine looks like this: .classpath .project .settings/ target/ This is in a multi-module maven project. All the submodules are imported as individual eclipse projects using m2eclipse. I have no further .gitignore files. Indeed, if you look in the gitignore man page: Patterns read … Read more

Unignore subdirectories of ignored directories in Git

According to pattern format section of the gitignore documentation: An optional prefix “!” which negates the pattern; any matching file excluded by a previous pattern will become included again. It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so … Read more