Companies often buy or merge with other companies using shares (which is sometimes less intuitive than when they use cash). This tutorial walks through the mechanics of how this happens and details what is likely to happen in the public markets because of the transaction (including opportunities for arbitrage).