He graduated from the United States Military Academy (West Point) in 1855 and was given a commission as a brevet second lieutenant in the 2nd U.S. Dragoons Regiment (heavy cavalry).
Gregg and the 8th Pennsylvania fought in the Peninsula Campaign, where he distinguished himself in the Seven Days Battles, expertly screening retreating Union infantry.
He received a furlough and married Ellen F. Sheaff on October 6, 1862, in Montgomery County, Pennsylvania; the couple honeymooned in New York City.
After Maj. Gen. Joseph Hooker assumed command of the demoralized Army of the Potomac, he shook up the cavalry organization, because the mounted arm had not been used effectively.
At the Battle of Chancellorsville, Stoneman's corps, including Gregg's division, was dispatched on a raid around Lee's left flank to destroy facilities in his rear.
The raid lasted nine days and caused a lot of destruction in the rear of the Army of Northern Virginia, but it accomplished little strategically and Stoneman was widely criticized for lack of aggression and not being able to draw any Confederate forces away from the main battle.
During the start of the Gettysburg Campaign, Lee's stealthy troop movements away from the Fredericksburg area caused Union consternation and Pleasonton was ordered to find out where they were going.
The battle overall was essentially a draw, although it surprised and humiliated Stuart, and orders left behind provided valuable intelligence about Lee's intentions to invade Maryland and Pennsylvania.
On July 16, during the Battle of Williamsport in the Army of Northern Virginia's long Retreat from Gettysburg, Gregg's division clashed with the cavalry brigades of Brig.
Gregg caused an incident when, after this engagement, he did not get adequate mention in Maj. Gen. George G. Meade's after action report and demanded a court of inquiry to correct the record.
Gregg's division also was heavily engaged at the Battle of Haw's Shop, where it fought Wade Hampton's troopers west of Hanovertown, Virginia.
Gregg's division survived a strong attack directed by Wade Hampton, but it lost several prisoners, including Colonel Pennock Huey.
Gregg commanded the cavalry division that remained near Petersburg while Sheridan was engaged in the Shenandoah Valley Campaign against Jubal Early.
[1] On December 12, 1864, President Abraham Lincoln nominated Gregg for appointment to the grade of brevet major general of volunteers to rank from August 1, 1864.
According to Edward Longacre's biography of Gen. John Buford, Gregg feared a violent death in battle and described himself as a "coward" when, in late 1864, his nerve finally gave way and he resigned his commission.
In 1868 he applied for reinstatement, but the cavalry command he wanted went to his cousin, John Irvin Gregg, so he remained an unhappy civilian.