Transferring the H1B to a different company is straightforward. However (and this happened to me) if the original company is sponsoring your green card, you will have to restart the green card application process with your new employer (unless you are in the final stage of the process). Bear in mind that the green card process can take several years. IMO this is an unacceptably high risk.
It is straightforward, but my understanding is that "transferring" an H1B is getting a new H1B via the new employer. The only differences are that (1) the new H1B won't be counted against the yearly cap and (2) you don't have to wait until 1st Oct to start working.