Human: Describe the major events of the Battle of Gettysburg. Assistant: 
The Battle of Gettysburg was a major engagement of the American Civil War, fought July 1–3, 1863, in and around the town of Gettysburg, Pennsylvania. Considered the turning point of the war, the Union victory put an end to General Robert E. Lee's invasion of the North and led to the eventual surrender of the Confederate army. On the first day of the battle, Confederate troops commanded by General A. P. Hill and General Henry Heth drove the Union forces back from the town of Gettysburg, successfully capturing the strategic heights south of town. On the second day of the battle, on July 2, Confederate forces tried to dislodge Union forces from the heights, but were repulsed in a bloody infantry battle. On the third day, July 3, a Confederate assault on the Union center failed, as Lee ordered an ill-advised attack, which was deflected by Union gunfire. That afternoon, General George Meade led a devastating counter-attack, driving Confederate forces out of Gettysburg. The battle ended with a Union victory and the Confederate Army's retreat to Virginia.