Thanks Chris,

\#* works with git and rsync to exclude files beginning with # on my
mac. I added --delete-excluded on my rsync script to remove the #
files that had been copied to my destination directory.

rsync excludes pattern  \#* did NOT exclude \#foo on my mac, it may
behave differently on a windows system.


On Jan 8, 2:32 pm, Chris Johnsen <> wrote:
> On Jan 8, 12:44 pm, Rick <> 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").
> --
> Chris
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
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to