Create a tar archive called my-directory.tar of a directory my-directory/ but excluding files of a specific filetype.
You can use this short tar command.
tar --exclude='*.svn' -cvf my-directory.tar my-directory/
Or this more verbose tar command.
tar --exclude='*.svn' --create --verbose --file my-directory.tar my-directory/
Replace the *.svn in the above examples with whatever file extension you need to prevent from being archived. Ie. *.git
--exclude tells tar not to process files or directories that match the specified pattern-c or --create tells tar to create a new archivev or --verbosetells tar to produce verbose outputf or --filetells tar that the next parameter will be the tar file to create, extract, append to, list, etc.