How to use tar compress a directory but exclude specific file or folders

I have a directory want to backup, but there is a .git folder I don't want to compress it anymore. So I did tar command as below:

tar -cjf your_dir.tar.bz2 your_dir/ --exclude='your_dir/.git'
Last modified: le 2018/10/11 14:34