Some of the second generation British tanks in World War One carried "unditching beams" atop the hull. I know the beams were used to extricate the tanks from holes, but I have never found any explanation of how this worked.
If a tank got stuck in the mud and the tracks were finding it hard to gain purchase (a common hazard in the artillery-churned no-mans-land of the Western Front), the unditching beam would be chained to both tracks. As the tracks travel under the tank, the beam would dig into the mud, providing a much better purchase, and then the tank would pull itself over the beam that has now dug into the ground. Once the tank had completely passed over the beam, it could be moved to the front end of the tank again, and the process repeated until the tank reached more solid ground.
You can see it working in this Lego model: