You might take a look at how the LBT folks do their component-swapout:
For me, a better method has been moving all of the logic of the component out to functions or classes in a package, and them importing those into the component. When you update the package’s logic, it also updates in all your GH-Files.
@AndersDeleuran had a good explanation of several other methods for managing your code in a recent post here.