Last updated 8 months ago
To exclude a directory while making a tar file, we can pass --exclude="" argument to tar command.
--exclude=""
tar
$ tar czf {FILE_NAME}.tar.gz --exclude=".git" --exclude=".github" ./
Here, .git and .github directory would be excluded; not included in the tar file.
Source: