After Lu Zhen (呂珍) seized Anfeng, Ding Yu surrendered to Zhu Yuanzhang (the future Hongwu Emperor).
Zhu Yuanzhang admired his military strategy, ordered Ding to concurrently serve as a commander (指揮), and changed his name to Yu.
[1] In 1368, he was promoted to the rank of Military Commissioner-in-chief (都指揮使) and concurrently served as Assistant Administiontrator (行省參政), guarding Guangxi.
Later, as a general of Pingqiang (平羌將軍), he put down the rebellion of Dong Tieli (董貼里), a native chieftain of Weimao, Sichuan.
At that time, Peng Pugui (彭普貴), a native of Sichuan, rebelled, and commander Pu Liang (普亮) was unable to quell it; later, it was suppressed by Ding Yu.