Like training wheels for dirt.
Won't help keep your pants up though.
A retaining wall is...
(1) A structure that prevents soil from slumping, sliding, or falling onto a trail. A retaining wall is usually made of logs, stone, soil-filled bags, blocks, or paving materials. Retaining walls are often used to provide stability and strength to the edge of a trail or stream bank.
Also known as: Revetment, Cribwall, Cribbing, Mono-Wall, Multi-Tier Wall.
(2) A structure intended to prevent trail incontinence. Since most trails are built up from or cut out of the landscape, they typically need some help keeping themselves together. Retaining walls do this. Retaining walls retain. They are like trail diapers. They keep soil from creeping out and messing things up when no one is looking, because once it starts it can get nasty, and then you have to look, and no one likes looking at nasty. The landscape enjoys doing this unauthorized creeping and will keep doing it, and before you know there will be no more trail, only a nasty mess. Which you will have to walk through. So there's where the "retaining" part comes in. And as for the "wall", look it up.
(3) A retaining wall is an anti-creep device. So far, retaining walls work only on dirt, which moves at a pace somewhere between glacial and geological, both of which are tediously boring. To see this process in action go look at a hill. Bring lunch and something to sit on. Within a scant several hundred years you will begin to notice the first faint signs that the entire hill is slowly glooping downward under the force of gravity, lubricated by rain. If that's where you are, down below somewhere, don't worry. You still have several hundred more years before it gets anywhere near you, and even then it probably will only gum you gently and spit you out because you don't taste good. Though this process could take several hundred millennia longer to reach completion, leaving you seriously late for any appointments you might have scheduled, it can be fun to observe if you don't have that much else going on. So yes, folks, it's true, all hills do move. Slowly. So very slowly. But go in and dig around and you disturb the whole balance of nature situation, and then everything speeds up, probably because it's pissed. Like if you cut a trail into the side of a hill and instead of waiting several hundred years to see anything at all (Anything! At all!), the whole shebang may spring a huge surprise by slumping over on top of you even before you have a chance to wipe off your shovel and pretend that you were only out there standing around doing nothing at all, just like every other innocent idiot in the vicinity.
So in this sense (of keeping disturbed soil from getting unpleasantly uppity, not to mention rapid), retaining walls are good. They are A Good Thing, and work well as anti-creep devices. But only for dirt.
They (so far) don't work on the kind of creep that might glom onto you while you are out backpacking and spoil what was otherwise a pretty decent day. So for now, you still have to carry a stick and know how to use it.
Another view, below, temporarily borrowed from the kindly Forest Service (slightly modified).
See tabs at the top for definitions and books.
Have anything worth adding? Then try sosayseff+eff@ gmail.com
Me? Been out doin' some slow creepin'. (Can be fun!).