Tar foo directory, and exclude "foo/.repo" directory
─foo
├─.repo
│ └─ example
└─ 1.txt
$ tar -cvf foo.tar --exclude='foo/.repo' foo
Remove directory "foo/.repo" from tar file
$ tar --delete foo/.repo -f foo.tar