The students of Springfield Elementary School take a field trip to the Springfield Glacier at 3:00am. Unfortunately, the glacier has melted almost completely away, and Lisa blames the melt on global warming. She tries to raise the other students' consciousnesses about global warning, but they ignore her and a ranger tries to shut her up. Bart, for his part, plays a practical joke on her as she desperately asks the students to save the glacier. Lisa's pleas go unheard, however, as the students are instead laughing hysterically at Bart's prank (which involves sending farting noises over a walkie-talkie while Lisa tries to talk).
Meanwhile, Homer and Marge go shopping at the Sprawl-Mart and find Grampa working there as a greeter. Grampa gets hurt, loses his people-greeting abilities and asks Homer to take over for him as the people greeter. Homer proves to be a success as a people greeter, prompting the manager to offer Homer a full-time position without any chance of advancement. Homer is pleased with the offer, due to the low expectations, and takes the job.
The next day, Lisa is still angry with Bart and gets a restraining order filed against him. Under the order, according to Chief Wiggum, Bart must remain twenty feet away from Lisa at all times. At first Bart doesn't listen, but after a test run of him getting thrown in jail for violation, he does. He is to follow the order or he will face more legal consequences. Wiggum shows the family a Gary Busey-hosted videotape, "Get Out of My Dreams and Also Out of My Car: A Guide to Your Restraining Order", which teaches Bart how to live with a restraining order. To make the restraining order more fun, Homer makes a 20 foot pole that can be used to warn Bart when he's less than 20 feet from Lisa and needs to move away (stupidly using and old screwdriver as the tip). Lisa, however, starts abusing the power of the restraining order and follows him wherever he goes (which in real life would result in the order being removed) and smiling while she repeatedly jabs him with the screwdriver. It gets so bad that Bart actually ends up with severe tissue damage in his arm from where she jabbed him. In their usual commute to school, Bart has to ride in a shopping cart that has been crudely tied to the back of the bus. At school, the order means that Bart can't even enter the school and he is forced to sit outside in the rain. Groundskeeper Willie becomes Bart's mentor later on, which proves difficult due to the shack Willie lives in being unsanitary and the Scotsman's threatening anyone who would try to correct him. (All of this occurring with Lisa looking at him from a distance with a smirk on her face.)
Two weeks into the order, Bart finally starts to get fed up with the near constant abuse from his sister as she never allows him to fully relax and finally begins to snap while sitting in the kitchen with Marge having a conversation.In the midst of talk, Lisa once again goes out of her way to make him miserable by roughly jabbing him in the arm. Bart finally shows clear signs of irritation and asks her if she could just let him finish his glass of milk. She neglects his reasonable request by deliberately knocking the glass over. Bart, knowing that he'll never win because of the threat of law involvement leaves the kitchen. This act of abuse is the final straw for Marge as Lisa had completely ruined a bonding moment between her and Bart and was practically tearing apart the entire family overall. Marge appeals in Family Court (with Judge Constance Harm hearing the case) to get the restraining order removed. Instead of pointing out that his behaviors were never too severe to warrant an order and Lisa's constant abuse and mistreatment of the system have proven threatening and harmful, Bart testifies that Lisa has no sense of humor and in the process manages to unintentionally insult the judge. Furious, Judge Harm increases the restraining order to 200 feet (61 meters as she explains to the Europeans in the back of the courthouse). Bart can now only live at the edge of the Simpson family property.
Lisa talks to Homer about how glad she is that Bart is now living in a tent at the edge of the property and gloats about how miserable he must be. However, she was completely wrong about the misery part, as instead Bart takes a look at nature and embraces it. He begins living outdoors permanently whether Lisa is home or not and runs with a pack of wild dogs happy that Lisa now can't harm him either. A few days pass and Marge, worried, asks Lisa if Bart has suffered enough. Lisa explains that she has a hard time forgiving Bart, and that she'll only lift the restraining order if she can think of three nice things Bart has done for her (two of which she and Marge come up with).
That night, at Sprawl-Mart, Homer finds out he's not so much a worker as he is a slave. He is forced to work all night and day without being paid, isn't even allowed to go to the bathroom, and he cannot leave the store because the management had a v-chip implanted in his head that will shock him painfully if he tries. After tearing out the chip (along with a portion of his skull and brain leaving him with minor brain damage), he lobbies his fellow associates at Sprawl-Mart to shut the store down, but they insist that they have learned to accept the things they cannot change and steal whatever is not nailed down, Homer eventually leaves the store on his own, driving through the front door in a fork lift loaded with several plasma TVs.
Back in the Simpson backyard the next afternoon, Bart builds a giant statue of Lisa using wicker to burn as a way to finally express the anger and sought after retribution he's been forced to withhold under threat of legal consequences. Lisa walks into the kitchen mocking Bart for his terrible phrasing in court, when she sees the statue and (unaware of Bart's actual reasoning for his actions) actually likes it so much, she forgives him and runs outside with the 20-foot "poking pole". Bart, fearing she's come to attack him because of his true intentions, begs her to just leave him alone because he can't take anymore. Lisa then tells him that she's not coming to attack him, but to forgive him because of the statue. Bart, seeing a window to get rid of the order and have his normal life back (along with possibly obtaining a more satisfying payback) plays along with Lisa's misconception. Unfortunately for him, just then, Dolph, Jimbo and Kearney show up carrying lit torches and announcing that they're ready to torch the "Wicker Witch of the West." Lisa is at first angry that Bart built the statue just to burn it (essentially, to burn Lisa in effigy), but she chooses to forgive him anyway (though only after Bart claims that "The fire represents your musical ability"). Lisa sets the statue on fire, and breaks the 20' pole in half. As it burns, Lisa throws the restraining order and the broken poking pole into the fire. As the closing credits start to roll, the statue keeps burning while the Simpsons play (and dance to) the Herb Alpert tune "Tijuana Taxi".