I need to backup a hierarchy. I need to keep the image as small and fast as possible. I use
tar -c --exclude="..."
with several --exclude=".."
patterns to omit quite a few directory/file patterns, and that works fine.
However, the hierarchy has several .git
sub-directories dotted around inside it and I do want to include anything below such directories encountered in the backup. There is a chance directories/files below .git
might match the --exclude="..."
patterns, and they would currently get excluded.
Is there any way to tell tar
that anything below a .git
is to be included, regardless of --exclude
? Or how could I handle this requirement?