Gregg commanded the Cavalry Corps of the Army of the Potomac in early 1864 until the arrival of Maj. Gen. Philip Sheridan, who commanded the cavalry of the forces of Lt. Gen. Ulysses S. Grant in the Overland Campaign. The most important use of Gregg's cavalry during this campaign was to screen Union movements southward, battle to battle, but a significant raid was staged that culminated in the Battle of Yellow Tavern, where J.E.B. Stuart was mortally wounded, dealing the Confederacy a hard blow. 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. Hampton had superior numbers, but Gregg's troopers had the Spencer repeating rifle. Finally, Custer's brigade attacked through difficult terrain, ousting Hampton's men from their position.