Export all habits, IDs, colours, targets and dated check-ins. On iPhone choose Save to Files in the share sheet. Backups contain personal data: keep them private.
Restore merges records. It never deletes existing habits or check-ins. Matching IDs combine dates once; conflicting names, colours or targets block the entire restore. Different IDs remain separate habits even if names match.