Melee

Melee is a form of attack which shunts the target and renders them stunned for a small amount of time (1-3 seconds, depending on infected type). It is possible that a melee attack will knock Common Infected down. They must stand back up again before they can attack, giving you ample time to either kill them or run away. It is extremely useful in defense against large hordes of Common Infected and rescuing other Survivors caught by Hunters, Smokers, or Jockeys.

Damage
The melee attack does not cause real damage, yet still it can kill the Infected. It takes 3 to 7 blows to kill a Common Infected (the Riot infected are, of course, impervious to melee attack as well as any attack from the front), and 4 blows to kill a Special Infected, with the exception of The Tank, The Witch and The Charger, which are immune to the attack. In addition Common Infected can be killed with one hit from behind when they are unaware of the Survivors. Sometimes they may get stuck on objects and become immune to melee attacks.

Survivors are immune to the melee attack, even though they flinch when they are hit. As no damage is done by the shove, any melee attacks on Survivors will not count as friendly fire; however, primary attacks with Left 4 Dead 2's Melee weapons will.

Witches are able to be shoved when they are lit up by a molotov or gascan but this is ill-advised, especially on Realism Versus, any difficulty that has Realism enabled, or Expert as you may end up being stumbled by the Witch by being in her way and she'll take a swing at you, incapping or killing you.

Rescuing other Survivors
When another Survivor is pinned by a Special Infected, the best and quickest way to help them out is to use your melee attack against either the Survivor or the Special Infected itself, which will free them instantly.

Hunter attacks
A Hunter will quickly tear away at a Survivor's health, so if you're low on ammo, or reloading, it can be best to use your melee attack against the Hunter to save them. Once a Hunter is knocked off, they will be temporarily stunned. When the stun wears off they will either attempt to make an escape to set up another ambush, or pounce immediately after. Be aware, especially on higher difficulties, that the hunter while stunned will occasionally glitch and be able to melee while stumbling.

Other uses of the melee attack is to melee them as they jump towards you, temporarily stunning them for a brief moment. When the Hunter is too close to attack with primary weapons (such as right in the middle of your team), clubbing the Hunter to death instead of shooting is a viable, and necessary, tactic on higher difficulties due to increased damage with friendly fire.

Smoker attacks
A Smoker's drag can be interrupted with a quick swipe of your melee attack, rendering it harmless for another 15 seconds. This means an effective team can save a Survivor from taking any damage if they react quickly enough (though in Versus the Smoker will damage as it drags). When someone is first caught by a Smoker, his or her teammates must make a fast decision. Either melee the tongue off of the victim, or shoot at the tongue itself, or shoot at the Smoker to kill it. If you melee, you minimize the damage taken by the victim, but you give the Smoker a high chance to get away and smoke someone again, perhaps in a worse situation. If you kill the Smoker, the victim will sustain more damage, and it will take longer to shoot the Smoker than a quick melee. This may help you in the long run, however, because then that same Smoker won't be able to grab you in worse situations down the road, such as on top of buildings or after a Boomer has blinded everyone. Shooting the tongue requires some precise aiming, which may not be possible when surrounded by the horde, but will be required in Versus as meleeing the tongue off Survivors is no longer effective.

You can also use your melee attack against the Smoker to free the Survivor. A Smoker will be stunned for about 1 second after their tongue breaks, meaning you have some time to deal damage to it before it retreats.

Jockey attacks
Meleeing a Jockey off a Survivor can be difficult since the Jockey steers the victim away from you. If you do catch up to it do a simple melee on the Jockey (not the survivor) and it will fall and become temporarily stunned. Like the Hunter it might try to jump again, scratch you, or run away. It is possible to 'Dead Stop' (melee as they jump towards you) the Jockey in any mode.

Charger attacks
While meleeing the Charger will do damage, it will not stun it in any way, so it is not recommended. If it charges and catches a Survivor, meleeing it will not make it let go; requiring gunfire or several proper attacks from a melee weapon to kill it. Similar to the Jockey, a melee shove will not work on the Charger as it is charging the Survivors.

Melee Spam
As of the latest update it is impossible to do an effective melee spam in Versus mode.

Melee spam is a phrase used to describe the constant and prolonged use of the melee attack to prevent attacks from hordes of Common Infected and pounces from Hunters. Usually when a Survivor becomes a victim of a bile attack they will back up into a corner and continuously use their melee attack until the hordes of infected have died down. This is because they cannot see their surroundings or the auras of other Survivors, and so the general panic of a massive attack causes them to go totally defensive.

Corner meleeing (also corner stacking, corner spamming) is when one or more Survivors sit in a corner and continuously spam their melee attack, making an almost impenetrable defense against all types of attacks except a Tank. Attacks which can have an effect include a Hunter pouncing above the Survivors and landing on one of them, a well timed Smoker attack, and a Tank attack. A Boomer will only extend the amount of time they spend in the corner, giving the other infected on the team time to respawn and set up an ambush.

Common times to see melee spam include: The best ways to attack a Survivor who does this is from behind, as the Charger, Smoker or Spitter. As the Hunter it is possible to pounce and land on top of them, especially if they are in a corner.
 * Crescendo Events,
 * Panic Events,
 * Boomer attacks.

Melee Fatigue
With an update for the PC and in the Survival Pack DLC for the Xbox 360, Valve has released a "melee fatigue" system. There is now a HUD display that will show your melee fatigue. If a Survivor swings too many times in a short interval of time, then they become fatigued and the HUD display will show the cooldown of the melee swing. This introduction to the game has helped deter melee spam and corner meleeing as the Survivors when a Horde attacks. It is applied only to the Versus and Survival modes of Left 4 Dead, but is present in all modes of Left 4 Dead 2.