After Hunter's withdrawal into West Virginia, Maj. Gen. Philip Sheridan was appointed commander of the Union forces (now called the Army of the Shenandoah) in the Valley. In December, Sheridan's army was transferred to Petersburg, and the 54th was assigned to the Army of the James, in which the 54th served for the rest of the war. It participated in the capture of Fort Gregg during the breakout at Petersburg and in the Appomattox Campaign. At the Battle of High Bridge, the entire 54th Regiment was captured, but was released four days later. The regiment was sent first to Camp Parole at Annapolis, Maryland, and then to Harrisburg, where it was mustered out on July 15.