A trench wider than the giant's stride and with the inside surrounded with a tripping hazard with a collapsible drawbridge and covered in net.
"Fun" fact. Elephants can't jump. They're too massive. Tripping is potentially fatal for an elephant.
A biologist once described it to me this way, "If a mouse, a human, and an elephant jumped off a twenty story building, the mouse would get up and shake it off immediately after. The human would die, but remain intact. The elephant would explode."
The point was the square inverse law.* The bigger a creature is, scaling up, the more the volume outpaces the directional support. A giant of anything remotely approaching fantasy proportions would not only be unable to jump, but a trip would be fatal and climbing short distances extremely hazardous.
Explanation of Inverse Square law:
Imagine a child's letter cube.
🞖 -> 1 square tall, 1 square wide, 1 square deep = 1 cube
Now imagine 8 of them arranged into a larger cube.
⊞ -> 2 squares tall, 2 squares wide, 2 squares deep = 8 cubes
The vertical is only doubled, but the volume is octupled. That means it weighs 8 times as much for only being 2 times taller.
That means, direct scaling a giant, if the giant was twice human size (a 'tiny' giant at only twice human size) a bone is only going to be twice as wide (supporting twice as much weight) but it's going to weigh eight time as much. It's muscles and bones, proportionally, have to carry (8/2) 4 times as much weight. So to get a similar experience as your giant, you'd have to have a backpack filled with 3 more of you (to make the total of 4 of you). At that point, you'd roughly feel what it's like to be a twice-scaled-up human.
And that's just double scale. At heights often showing up in fantasy (say, tall enough to climb over a castle wall), their difficulty moving would be ridiculous.