Learn the Hammer-On Technique from a Fingerstyle Master
Hammer-ons and pull-offs are graphically represented by a slur, or curved line, connecting the notes, as shown in Example 1. When the pitch ascends, the slur represents a hammer-on. When the pitch descends, the slur represents a pull-off. The tablature might be additionally marked with an H for a hammer-on and a P for a pull-off, though this marking is not considered necessary.
A hammer-on can begin with plucking either an open or a fretted note. Each hammer-on in Example 2 begins with an eighth note played on an open string followed by a hammered eighth note (note that this example is played in second position). In preparation, the fretting-hand finger should be raised as much as an inch above the fingerboard. After you pluck the open string with the designated picking-hand finger, hammer the fretting hand finger down quickly, keeping the fingertip perpendicular to the fingerboard. The motion should originate by engaging the knuckle joint of the fretting-hand finger. As with the picking-hand hinge, this is where the power and ultimate control lies.
Excerpted from The Alex de Grassi Fingerstyle Guitar Method