In the 13th year of Great Cause, anti-Sui Jun swarmed everywhere, and Jiangdu, where Yang Di was located, was isolated. Jinyang made Liu Wenjing and Jin Yanggong supervisor Pei Ji become close friends of Li Shimin. Li Shimin and Jinyang county magistrate Liu Wenjing conspired to arise.
After the conspiracy of rebellion was confirmed, Tang Gaozu didn't know it. Li Shimin wanted to tell the truth, but he was afraid that Tang Gaozu wouldn't listen. Li Shimin privately consulted Pei Ji, who chose several beautiful women in Jin Yanggong and spent the night with Tang Gaozu after he got drunk. Then, Pei Ji told Tang Gaozu about Li Shimin's plan, and Tang Gaozu was frightened. Pei Ji said: arrange a maid-in-waiting to wait on you, and kill your head after the incident is exposed. I only did it to convince you to make up your mind to fight.
Li Shimin took the opportunity to report the whole plan to Tang Gaozu. Tang Gaozu strongly disagreed at first, and said he would send Li Shimin to the newspaper. After a while, Li Yuan agreed to get up and say to Li Shimin: I love you. How can I have the heart to report you? In the 13th year of the Great Cause, in February of the lunar calendar, Liu Wuzhou, a captain of Mayi Xingyang Prefecture under Li Yuanzhi, launched a mutiny, killed Wang Rengong, the magistrate of Mayi, and claimed to be the son of heaven of Mayi. In March of the lunar calendar, Liu Wuzhou invaded loufan county, occupied Fenyang Palace and colluded with the Turks in an attempt to compete for the world. Emperor Yang-ti was furious when he heard the news, and wanted to take Tang Yuan to Jiangdu for punishment. In this critical situation, Li Shimin said: It is urgent, so you can do something.
Pei Ji, Xu, samurai _ and other confidants around him also advised Li Yuan to fight, and Li Yuan finally made up his mind to fight against Sui. Therefore, Tang Gaozu, on the pretext of guarding against Liu Wuzhou and Turkic southward, sent Li Shimin, Liu Wenjing, Shunde, Sun Qiang, Liu Hongji and others to recruit people everywhere, and thousands of people were recruited in a short time.
Wang Wei and Gao Junya, the deputy left-behind in Taiyuan, saw that Li Yuan was recruiting and suspected that Li Yuan was going to rebel, so they conspired to trick Li Yuan and his son into praying for rain in Jinci to get rid of Li and demanded a reward. Unexpectedly, this conspiracy was learned by Liu Shilong, the head of Jinyang Township, and told Tang Gaozu. In the 13th year of the Great Cause, on the 15th day of the fifth lunar month, Li Yuan and Li Shimin pre-emptively ordered Sima Liu of Kaiyang Prefecture to report that Wang Wei and Gao Junya had secretly colluded with the Turks and led them to invade the Central Plains, thus imprisoning them. On May 17th of the lunar calendar, it happened that tens of thousands of Turkish troops attacked Jinyang, and Tang Gaozu immediately ordered people to behead them. In June, he sent his two sons Li He to attack and kill Gao Deru, the county magistrate of Xihe who refused to live. At the same time, Tang Gaozu made an empty plan to scare off the Turkish army. So, began to prepare for the anti-Sui.
In the 13th year of the Great Cause, in July of the lunar calendar, Li Yuan led an army of 30,000 pledging troops and officially set out. In the published campaign, he rebuked Yang Di for listening to slanderers, killing Zhongliang, being militaristic, and people's resentment was boiling.
After being sworn in, Li Yuan and his eldest son were built, and the second son Shimin sent troops to the south. Sui Ying Yalang, who defended Huoyi, crossed the Yellow River with Song Laosheng and besieged Qu Tutong, who defended Hedong. Quickly push southwest. At that time, Yang Diyuan was in Jiangdu, and the Sui army entering the customs was weak. The wagang army in the Central Plains was too busy to care about the west with one side of the fierce battle. So, Li and his son marched into Chang 'an with great speed, and the great cause entered Chang 'an on the 11th of the 13th lunar month.
Soon after Tang gaozu entered Chang 'an, he announced that Yang Di was revered as the emperor's father at a distance, and Yang Disun was appointed as the emperor instead of the king, and was renamed as Yining and Emperor Yangdi. Gong Jin named tang gaozu king, prime minister and minister, and Li Jian prince. For the sake of Jing, he changed the seal of Qin Guogong; Li Yuanji was made king of Qi.
In the second year of Yining, Li Shimin moved to seal Zhao Guogong. In March of the same year, Emperor Yang Di was killed by a mutinous imperial general in Jiangdu. In the same year, in May of the lunar calendar, Emperor Yangdi forced Zen, and Emperor Li Yuan established Chang 'an, with the title of Tang, Jianyuan Wude and Chang 'an as the capital. Tang Gaozu asked Li Shimin to be a secretary. Soon, he was appointed as the Crown Prince, named Li Shimin King of Qin and Li Yuanji King of Qi.