The popular bar prank known in colloquial English as beer tapping consists in
hitting the top of a beer bottle with a solid object, usually another bottle,
to trigger the foaming over of the former within a few seconds. Despite the
trick being known for long time, to the best of our knowledge, the phenomenon
still lacks scientific explanation. Although it seems natural to think that
shock-induced cavitation enhances the diffusion of CO$_2$ from the
supersaturated bulk liquid into the bubbles by breaking them up, the subtle
mechanism by which this happens remains unknown. Here we show that the overall
foaming-over process can be divided into three stages where different physical
phenomena take place in different time-scales, namely: bubble-collapse (or
cavitation) stage, diffusion-driven stage and buoyancy-driven stage. In the
bubble-collapse stage, the impact generates a train of expansion-compression
waves in the liquid that leads to the fragmentation of pre-existing gas
cavities. Upon bubble fragmentation, the sudden increase of the
interface-area-to-volume ratio enhances mass transfer significantly, which
makes the bubble volume grow by a large factor until CO$_2$ is locally
depleted. At that point buoyancy takes over, making the bubble clouds rise and
eventually form buoyant vortex rings whose volume grows fast due to the
feedback between the buoyancy-induced rising speed and the advection-enhanced
CO$_2$ transport from the bulk liquid to the bubble. The physics behind this
explosive process might also be connected to some geological phenomena.