A great general is someone who possesses many skills - social, tactical, strategical, military knowledge - and can adapt to any situation and be victorious. I do not consider someone to be a great general only because they won many battles because in many cases the weapons or type of warfare already practiced by the general's culture was superior to another and simply had to be unleashed against an incompetent enemy, like in the case of Genghis Khan and Alexander the Great. They were brave and good generals, but never proved themselves geniuses.
I'm not familiar with every great commander in history so we're all answering famous people (famous for their influence in history which is often just lucky timing) even though there are many others who have not achieved the recognition in history that they deserve, and who I know less about and may be better generals, such as Flavius Belisarius.
I don't know much about naval history but Nelson is of course among the best.
As for land forces commanders, I vote for Julius Caesar because of his great rapport with his soldiers he earned their vital loyalty and maintained tight command of them in and out of battle. He was a political and militarily cunning, and an excellent tactician winning battles against larger, identically equipped and disciplined armies by adapting to his opponents tactics.
I also say Napoleon for the reasons mentioned by others though I know few details about him.
Richard the Lionhearted was an incredible man who deserves at least honorable mention. He re-conquered the canaan (without attempting Jerusalem) with a tiny, swift moving, extraordinarily disciplined force, and was a demon in combat. He could adapt to use unusual mixes of soldiers for maximum effectiveness and quickly react to enemy moves. He was so extraordinary that eventually the muslims thought he was God in human form punishing them.
I say Saladin for the classiest general.
And like I said in the beginning, there are many brilliant generals including many in more recent history, but we only remember the most famous off the top of our heads. Haha this question would require too much research.