Then they fought under Philip Sheridan in the Valley to ensure that no more Confederate armies would invade again .