Say, you want to rsync two directories(/tmp/foo and /tmp/bar) on your box but, you want to sync only gif files. Below is the way to do it using include and exclude parameters.

rsync -a --include '*.gif' --exclude '*' --delete /tmp/foo /tmp/bar

The position of the parameters is very important while using rsync because the previous argument can influence the next one.