The quick answer is they didn't. At least not quickly or efficiently. The first ruler of a united Japan was not Tokugawa Ieyasu. Arguably it would have been Oda Nobunaga then followed by Toyotomi Hideyoshi. Tokugawa Ieyasu only became shogun after the other two died. Which reminds me of a Japanese poem that when these three men are asked what would they do if their canary wouldn't sing. Nobunaga says I would force it, Hideyoshi says I would trick it, Ieyasu says I will wait.
What was key here is that when Toyotomi Hideyoshi too power he was a commoner and could not become Shogun. He styled himself Kampaku. Which was Shogun all but in name. He would put down some small rebellions throughout his reign, but the big deal would be the Japanese invasion and occupation of Korea. The Japanese though initially successful would eventually loose due to a superior Korean Navy and a debilitating insurrection among the Korean people. After 6 years the Japanese pulled out. Hideyoshi died soon after.
With Hideyoshi's death Ieyasu raises the flag of war and defeats the Toyotomi forces at Sekigahara. Toyotomi then had some quick mopping up to do. This would be followed by a christian rebellion in the west. While all this was going on lords would be getting shuffled around. losing castles gaining castles. The lords families would be required to stay in Edo hostages most of the year of the Shogun.
They never really stopped fighting the fighting just was never as intense as the period before it. The Toyotomi clan would effectively use ceremony, tradition and laws to keep discontent to a minimum. If your interested in further reading I always recommend Steven Turnbull. His books are packed full of knowledge, easy to read and have some cool pictures.