Dogs dig for many reasons. They dig when they're bored, stressed, lonely, hot, or because they're hunting for prey (real or imagined). The best approach to curb this often-destructive activity is to redirect your dog's desire to dig toward activities that are more acceptable to you and your neighbors.
Provide plenty of exercise
Chances are good that if you provide your dog with plenty of other exercise—such as walking, running, and general good-time playing—his digging activities will lessen, or disappear all together.
For dogs that dig out of a hunting instinct, it's important to keep them away from areas that may have burrowing animals or insects. Keep an extra close eye on your dog in natural areas such as parks, open fields, and yards.
The indoor option
As a last resort, you can confine your dog indoors or in a shaded, cemented area for short periods of time. This may help him break the habit. Although confinement is not the solution—and you should only use this as a temporary option—it will certainly keep your dog from destroying your garden and yard. An added benefit is that an extended indoor "time-out" gives you (and your dog) a necessary break before starting over with the training techniques described above.