In November 1862, Grubb was promoted to Major, and was transferred to the 23rd New Jersey Volunteer Infantry, a nine-month enlistment unit made up of men from his hometown of Burlington and various parts of Burlington County. In March 1863, despite his youth, he was promoted to Colonel and commander of the regiment when its previous leader, Col. Henry O. Ryerson, left to take command of the 10th New Jersey Volunteer Infantry. He led his regiment, nicknamed "The Yahoos", as it participated in his brigade's assault on Confederate positions at Salem Church during the May 1863 Battle of Chancellorsville. Wounded in action, he was mustered out when his regiment's enlistment expired by law in June 1863.