Here's what I think may happen. This is all just entirely speculation...
The prison group packs up their supplies after deciding to leave. Glenn and Maggie come back from a scouting trip and report that the farm has cleared of the herd. After everything is packed up, and maybe another trip to the canteen, they leave. But not before Rick decides to open the cell block doors, allowing walkers to flood the cell block.
Back at Woodbury, Phillip makes an impassioned speech to the people about destroying the prison group. Almost the whole town takes up arms against Rick's group with the exception of Milton, Tyrese, Sasha, Karen, Noah and Andrea (obviously). Meanwhile both Andrea and Milton have been locked up by Phillip. He savagely beats Milton before going to tell Andrea about how he's going to kill her friends. Andrea pleads with him, trying to appeal to his humanity while he simply tells her it's how the world works now. You kill or you die. The Woodbury soldiers pack up and leave for the prison.
Upon arriving at the prison, Martinez destroys a guard tower using a grenade launcher. The soldiers clear away the walkers with ease. They reach the courtyard and find no one. Allen opens the door into Cellblock: C only to see walkers shamble out. While he is able to kill some. He either retreats or is devoured. While the rest of the soldiers are overwhelmed, Phillip, Martinez, Shupert and possibly Allen leave in the car while Phillip becomes enraged at what Rick has done.
Meanwhile, Rick, Daryl, Michonne, Glenn and Carl sneak into Woodbury, having sent everyone else to Hershel's farm. They subdue the remaining soldiers left behind and take control. Rick explains his side of the story to the remaining residence, and apoligizes to Tyrese and Sasha explaining they had just suffered terrible loses in their group at the time, including Lori. Meanwhile Michonne frees Andrea. After a bit more exploring they find a bloodied and weak Milton. Michonne takes him out to Rick where they debate killing him. Andrea intervenes saying that Milton is on their side. He's also Phillip's former advisor so he knows what he'd be up to. After a little more deliberation, Rick abstains from killing him. Milton thanks him.
Meanwhile as The Governors jeep drives back, they encounter a small herd in the road. With nowhere else to go, Phillip floors the accelerator and drives through the herd. Very quickly they become stuck and attract most of the herd to the jeep. The Governor tells Allen to go up through the sunroof and look for a clearing. Allen complies. But when he does, he is thrown off of the jeep and into the herd. The jeep becomes unstuck while Allen is torn apart. (If not Allen then an unamed soldiier) They drive off while the herd feasts.
Back at Woodbury, The Governor's jeep pulls up to the sealed gates. The gates suddenly open where upon they are greeted with the sight of Rick's squad, Andrea, Milton, Tyrese, Sasha, Noah and Karen armed with guns. All aimed at the jeep. After a few seconds of nothing, the jeep speeds into the group, with Daryl Michonne and Sasha being hit by the jeep and thrown clear. The occupants of the jeep climb out and raise their guns too. The Governor attempts to kill Milton but accidentally kills Karen. Daryl, although weakened by the jeep ramming him, is able to aim his crossbow at Martinez who is about to kill Rick, and fires an arrow into his chest, killing him. Rick's lot recover and after realising that they would be slaughtered, Shupert surrenders. Shortly after, Phillip also surrenders. Milton declares that Shupert is trustworthy, while the rest are unsure. Michonnes smiles at the Governor and his defeat while he just glares. Rick sends Glenn and Tyrese to retieve the rest of their group.
Upon arriving at Woodbury, the groiup rejoices at their victory. While they're distracted, Phillip takes his chance to steal Andrea's gun and shoot Rick. However he misses and kills an unexpecting Beth who is holding Judith. Both are killed by the bullet that pierces Beth's chest. The bullet continues through Beth and Judith and hits a shocked Carol in the shoulder. While the group are caught off guard, the Governor grabs Andrea and holds her hostage, yelling that everyone but Michonne must leave if they want her to live. Unbeknownst to them, they forgot to destroy Martinez's brain. He reanimates and attacks the Governor. He bites his shoulder and tries to pull him down. While in agony, the Governor fires his gun off in a panic, hitting Rick in the leg, Milton in the stomach, Noah in the head and Sasha in the shoulder. Glenn steps up, killing the zomified Martinez and hesitating when contemplating whether or not to let Phillip suffer. While suffering greatly, Phillip tells him to do it, so he can see his wife and Penny again. He complies and shoots him in the head.
At the same time, Rick, Daryl, Sasha, Carol and a dying Milton are carried to the infirmary lead by Shupert. When they arrive Dr Stevens is hesitant to help them, but after both Milton and Hershel's insistance she does. Hershel helps Dr Stevens with the surgeries. After a few hours, Rick, Daryl and Sasha recover and are bandaged up and given the proper medicine. But it's revealed that both Carol and Milton may not survive. They both discuss what should happen if they do not make it. Carol says stop her from reanimating not wanting to suffer like Sophia. Milton says to let him turn as he's curious as to what it'll be like as a walker. While Carol does not succumb to her wounds, Milton does. Hershel says Milton was a smart man and asks that they obey his last wish. Rick agrees. They drive a few miles out and release a now zombified Milton before heading back.
Back at Woodbury, a mass funeral is held for the fallen. Rick is on crutches, Daryl is in a wheelchair with a bandaged Carol sitting on his lap. Tyrese hugs Sasha, Hershel, Glenn and Maggie mourn Beth's death while Rick and Carl mourn the death of Judith. Andrea mourns after Phillip despite what he's done. A bonfire is lit in the middle of Woodbury to act as a memorial. Looking beyond the fire, Rick sees Lori's ghost one last time, looking angry about Judith. He shakes his head and looks up. She's gone.
In the morning, Shupert and Dr Stevens announce that they are leaving Woodbury, saying too much has been spiled and that they need to find somewhere else. They are given some supplies and and a car.As they drive off the gates close behind them. Maggie and Gllenn ask Hershel to officially marry them saying he's the closest to a minister that they're likely to find. They also present him with a leg brace which resembles Merle's arm apparatus. Rick speaks to the remaining survivors saying that they have finally found a true place to call their own. He also says that while people may want to take it from them, they're prepared and they know what to expect. Later that day, Maggie and Glenn tie the knot with either Maggie taking Glenn's surname or Glenn becoming a 'Green'.
Afterwards the survivors decide who should take which houses. Hershel, Carol and Dayrl take a house together, while Glenn and Maggie take their own. Rick and Carl take the Governors old house, while Tyrese and Sasha take one for themselves. Michonne and Andrea live with Rick and Carl after they're asked by Rick. They all settle in as the sun sets.
In the morning, Rick assembles the group for breakfast. He says that although some of their friends and family lost their lives here, it's their home now. He also announces that instead of him solely being in charge, he will stick to what he said before and give people a say. Because of the stress of being the leader, he appoints Daryl Hershel and Michonne as the other 'co leaders'. As the episode ends, Rick taks to Andrea privately saying that although she's there to stay, she's got some ways to go before he can completely trust her. The episode ends with him walking off into Woodbury as walkers start to approach the walls.