The beginnings were in British politics where “Whigs” were constutionalists, opposed to absolute monarchy. “Tories” favored the King. (Presbyterians and other dissenters were Whigs.) In the American Colonies in 1776 you were either a Tory (favoring England) or a Whig (favoring independence or revolution). After England was repelled, most Tories fled to Canada or England. (A lot of the early settlers of the upper Hudson River, where I now live, were Tories who fled to Canada. I am trying to find out how the property they abandoned was claimed and divided.)
In the 1780's and ‘90's, the original Whigs divided into “Federalists” and “anti-Federalists.” John Adams and Alexander Hamilton were Federalists, wanting a strong executive branch of government and a national bank to support business and bankers.
The “anti-Federalists” began calling themselves “Democratic-Republicans” or just “Republicans,” and were sometimes called whigs, jacobins, anarchists, and even disorganizers. They favored a strong legislature against the executive.
This was the party of Jefferson and Madison. By the time of Andrew Jackson, they were just “Democrats.” Are you confused yet? Whigs called Jackson "Jackass," and he took the symbol with pride. Thomas Nast, the political cartoonist, made it famous.
From Jackson’s presidency (1829-1837) onward we are in the “second party” era. Federalists disappeared as a party, and new “Whigs” formed to oppose Jackson, and to oppose the extension of slavery into the new territories of the west. Henry Clay and Daniel Webster were Whigs, as was Lincoln. Goldfield explains how the Republican stance against slavery was at root a pro-growth and pro-business view. Lincoln, after all, was a lawyer for the railroads, and made sure that the transcontinental rail lines were completed, even while the war raged.
It seems that the Republicans were happy for the support of Abolitionists, but that was their issue only insofar as slavery was a value that would inhibit industrial growth. The Republicans wanted Union and the end of slavery, and after the war they promoted the freedom and civil rights of former slaves in the South. So by the end of the Civil War Southerners wanted nothing to do with Republicans. In 1874 Nast drew a cartoon with a donkey in a lion’s skin, scaring the other animals in the zoo. The elephant was labeled “The Republican Vote,” and became the party’s symbol.
After the Civil War Southerners had enough of Democratic support of Negroes, and so the Democrats benefited from the South’s dislike of Lincoln’s Republicans. With slavery over, the Republicans pursued their commercial interests. It wasn’t until the 1972 election that Nixon successfully carried out a “Southern strategy” that brought the South into the Republican party. This was again mostly because of race, but now the Democrats defended the civil rights of African Americans. Today’s Democrats descend from Jefferson and the anti-Federalists, while the Republicans came out of the Federalist and Whig parties.
The history of these things is much messier than that, but that’s the best I can understand and explain it to this point. Please comment if you think you know more than I, and you probably do. Now I think I can talk about the mid 19th century with a bit more clarity. At some point I need to digress and talk about Presbyterians and Mormons (Oh, yeah), but I will try to remain focused.