On Jan 8, 12:44 pm, Rick <wrink...@gmail.com> wrote:
> I have a habit of prepending '#' to filenames that I wish to archive
> or ignore. So myfile.txt becomes #myfile.txt . I found that I can
> ignore these files  by placing "*/#" in the .gitignore file in my home
> directory (or in the repository exclude file). BTW, this also works
> for rsync.
> To be honest, this started as a question, but I figured it out while
> typing this post. :)

gitignore(5) says that it eventually uses “fnmatch(3) with the
FNM_PATHNAME flag”. fnmatch(3) says that unless FNM_NOESCAPE is given
(it is not), backslash is used to escape the following character.

So, use something like this:

    # exclude directory entries starting with a hash

This specific pattern also seems to work with rsync, but rsync seems
to require a wildcard (* ? [) before the backslash will act as an
escape character, so Git and rsync would not treat "\#foo" the same
(Git would match "#foo", rsync would match "\#foo").

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To post to this group, send email to git-us...@googlegroups.com.
To unsubscribe from this group, send email to 
For more options, visit this group at 

Reply via email to