How to archive all Magento 2 files excluding not important for development ones?

tar \
	--add-file='./pub/media/import/.htaccess' \
	--add-file='./pub/static/.htaccess' \
	--add-file='./var/composer_home/.htaccess' \
	--add-file='./var/composer_home/auth.json' \
	--add-file='./var/composer_home/packages.json' \
	--exclude='*.gz' \
	--exclude='*.mov' \
	--exclude='*.mp4' \
	--exclude='*.ogv' \
	--exclude='*.pdf' \
	--exclude='*.tgz' \
	--exclude='*.webm' \
	--exclude='*.zip' \
	--exclude='./.cache' \
	--exclude='./.easyssl_backup' \
	--exclude='./.github' \
	--exclude='./.gnupg' \
	--exclude='./.sucuriquarantine' \
	--exclude='./.well-known' \
	--exclude='./__MACOSX' \
	--exclude='./adminer.php' \
	--exclude='./blog' \
	--exclude='./catalog/product/cache' \
	--exclude='./cgi-bin' \
	--exclude='./dev' \
	--exclude='./dist' \
	--exclude='./generated' \
	--exclude='./magmi' \
	--exclude='./node_modules' \
	--exclude='./old*' \
	--exclude='./ow_scripts' \
	--exclude='./pma' \
	--exclude='./pub/*import*' \
	--exclude='./pub/images' \
	--exclude='./pub/media/.thumbscatalog' \
	--exclude='./pub/media/amasty/amoptimizer_dump' \
	--exclude='./pub/media/amasty/amoptmobile' \
	--exclude='./pub/media/amasty/amopttablet' \
	--exclude='./pub/media/amasty/webp' \
	--exclude='./pub/media/amazon' \
	--exclude='./pub/media/cache' \
	--exclude='./pub/media/captcha' \
	--exclude='./pub/media/catalog/product/cache' \
	--exclude='./pub/media/catalog/tmp' \
	--exclude='./pub/media/descriptions' \
	--exclude='./pub/media/ebaymultiaccount' \
	--exclude='./pub/media/feed' \
	--exclude='./pub/media/fishpig/resp' \
	--exclude='./pub/media/fishpig/webp' \
	--exclude='./pub/media/helpdesk/attachments' \
	--exclude='./pub/media/import' \
	--exclude='./pub/media/importexport' \
	--exclude='./pub/media/ipattachments' \
	--exclude='./pub/media/magefan_blog' \
	--exclude='./pub/media/mageworx/downloads' \
	--exclude='./pub/media/magic360/cache' \
	--exclude='./pub/media/megnor_blog' \
	--exclude='./pub/media/order' \
	--exclude='./pub/media/po_image_optimization_original_images' \
	--exclude='./pub/media/po_image_optimization_temp_images' \
	--exclude='./pub/media/product/cache' \
	--exclude='./pub/media/quotation' \
	--exclude='./pub/media/shipment*.png' \
	--exclude='./pub/media/shoppingfeed' \
	--exclude='./pub/media/tmp' \
	--exclude='./pub/sitemap/*' \
	--exclude='./pub/static' \
	--exclude='./pub/ub-tool' \
	--exclude='./pub/webanalyze/*' \
	--exclude='./pub/wp' \
	--exclude='./sucuri-backups' \
	--exclude='./test' \
	--exclude='./tmp' \
	--exclude='./var' \
	--exclude='./vendor/magento/magento2-base' \
	--exclude='./vendor/magento/sample-data-media/catalog/product' \
	--exclude='./wp' \
	--exclude='./wp-content' \
	--exclude='.git' \
	--exclude='sitemap*.xml' \
	--ignore-failed-read \
	-czvf ~/${PWD##*/}-$(date '+%Y-%m-%d-%H-%M').tgz .

See also:

Cleanup

Archiving