You can check things in /lib/upgrade/keep.d/

These files list which file or folder will be kept when upgrade. So you can remove what you do not need and upgrade with keeping settings.