Você exclui a regra está correta. No entanto, o rsync não excluirá arquivos excluídos no destino sem o parâmetro extra --delete-excluded
:
--delete-excluded also delete excluded files from dest dirs
Exemplo:
# tree test
test
|-- 123
|-- branch1
|-- branch2
|-- branch3
'-- other
# tree test2
test2
|-- 123
|-- branch1
|-- branch2
|-- branch3
'-- other
# rsync -avh test/ test2 --delete --exclude='branch1' --delete-excluded
sending incremental file list
deleting branch1/
sent 140 bytes received 27 bytes 334.00 bytes/sec
total size is 0 speedup is 0.00
# tree test2
test2
|-- 123
|-- branch2
|-- branch3
'-- other
3 directories, 1 file