The 12th New York Volunteer Infantry (2 year) was organized at Elmira, New York and mustered in May 8, 1861 for two years’ state service under the command of Colonel Ezra L. Walrath. On May 13, 1861 the regiment was re-mustered for three months’ federal service and again re-mustered on August 2, 1861 for two years’ state service.

The regiment was attached to Richardson’s Brigade, Tyler’s Division, McDowell’s Army of Northeast Virginia, June to August 1861. Richardson’s Brigade, Division of the Potomac, to October 1861. Wadsworth’s Brigade, McDowell’s Division, Army of the Potomac, to March 1862. Butterfield’s 3rd Brigade, Porter’s 1st Division, III Corps, Army of the Potomac, to May 1862. 3rd Brigade, 1st Division, V Corps, to May 1863. Headquarters, V Corps, to June 1864.

The 12th New York Infantry mustered out of the service on May 17, 1863. Men who had enlisted for three years’ service were consolidated into two companies and served duty as Provost Guard for Headquarters of V Corps under the command of Captain Henry W. Ryder. These two companies ceased to exist on June 2, 1864 when their members were transferred to the 5th New York Infantry as Companies E and F. Although transferred to the 5th, the two former 12th New York companies remained on duty at corps headquarters.

Source: Wikipedia

See Also