csharpier icon indicating copy to clipboard operation
csharpier copied to clipboard

Ignoring file because of gitignore

Open rosieks opened this issue 4 months ago • 3 comments

In git ignore I have the following line

Backup*/

Because of that csharpier was ignoring file under path .\stacks\storage\src\Backup\Stack.cs despite that VS and git have no problem with it.

rosieks avatar Aug 12 '25 10:08 rosieks

.\stacks\storage\src\Backup\Stack.cs would be considered ignored by the rule Backup*/. If you've specifically added the file to git csharpier will not take that into account unless you add a negated rule to the gitignore. IE !.\stacks\storage\src\Backup\Stack.cs

belav avatar Aug 14 '25 01:08 belav

Is it by design that it works differently from Git? Because Git does not ignore it - it would only do so if the rule were **/Backup*/.

rosieks avatar Aug 14 '25 06:08 rosieks

I'm talking about how git works and tested what I said in the original comment to be sure I was correct. The info below is taken from https://git-scm.com/docs/gitignore.

If there is a separator at the beginning or middle (or both) of the pattern, then the pattern is relative to the directory level of the particular .gitignore file itself. Otherwise the pattern may also match at any level below the .gitignore level.

If there is a separator at the end of the pattern then the pattern will only match directories, otherwise the pattern can match both files and directories.

For example, a pattern doc/frotz/ matches doc/frotz directory, but not a/doc/frotz directory; however frotz/ matches frotz and a/frotz that is a directory (all paths are relative from the .gitignore file).

belav avatar Aug 14 '25 12:08 belav