The ancestors of the Pembroke Welsh corgi goes back to the "Spitzen". That are dogs from the far North, and are recognisable by their pointy muzzle, a foxlike head, standing pointy ears, a high set tailbase and a high carriage of the tail. 

The Vikings would have taken these dogs on their travels, and traded them for neccesities, or escaped by accident and mated with other regional breeds. The Västgötaspets and the Schipperke are the breeds that are most likely the ancestors of the Pembroke Welsh corgi. De origene of the Pembroke Welsh corgi lies in Pembrokeshire, That is located in Wales. They were used by farmers to herd sheep, horses and cows.
The first corgi-like dogs can be found from the beginning of the 12th century. probably even earlier, around the 10th century, under the reign of Hywel Dda, King of Wales. Till 1934 the Pembroke Welsh corgi and the Cardigan Welsh corgi were bred under the same breed, the "Welsh corgi". The word corgi is a combination of the Welsh words 'Cor' (dwarf) and 'ci' (dog). another possibility is that the word corgi was derived from "cur dog". This indicates that it was a workingdog and not a companion dog. both corgi breeds were bred to eachother, but accordig to Thelma Gray, it didn't happen alot. 

In Pembrokeshire you mostly saw the Pembroke Welsh corgis and in Cardiganshire the Cardigan Welsh corgi. For the farmers in poverty the breedtype didn't matter. They only wanted strong workingdogs and they were mostly bred for their working abilities. Because travelling was expensive, they mostly used dogs from the neighbourhood to breed with. That is why a lot of breeds in the early stages were more 1 type you saw in a region, because the dogs in the neighbourhood got bred to eachother. In the beginning longhaired corgi's (fluffies) were also present, according to Mrs. Grey, this was due to the longhaired gene of the Welsh Collie, which also comes in blue Merle.

The short legs of the corgi had their advantages. It was easier for them to manouvre over the rough and rocky landscape of Wales. Also most animals kicked over the corgi.

Around the 10th century farmers could only keep little dogs, capable of killing pests. Shepherds could keep their dogs but they needed to be dockes, so they wouldn't be able to kill the wildlife of the noble. They thought the docking of the tail would decrease the speed. Most tried to keep their dogs undocked, but the fines were too high. The law wasn't working out, so they decided to raise taxes if you wanted to keep a dog undocked. only farmers that couldn't pay the taxes, needed to dock the tail

According to another auteur, Iris Combe, The corgi went way back to the Nordic breeds, that were kept by families, who lived of fish, seabirds and their eggs. They lived on poor agricultural land and most of the times not a lot of land. In Wales they kept a lot of geese and ducks.

It is known that the Corgi was used as a heeler and drover for lifestock. The Corgis are called a heeler because of their style of driving the lifestock. they nip the lifestock in the hock, to make them move. Also we see dogs that "headen": this is where they jump to the face when they are unwilling to move. They also protected the livestock, with chickens and other birds walking around predators were always lurking around. At night the corgi's helped the farmer with gathering the animals so they could be locked up for the night. When the farmer had to go to the market the corgi's would help the farmer with the transportation of livestock to the market. Multiple dogs worked together to move the animals alongside the road. They say they were quiet workers, because too much noise would scare the animals away.

Corgi-like dogs also were kept as so called turnspit dogs untill the half of the 19th century. Shortlegged dogs with a longer body and curved legs were used as little helpers in large families or pubs. The dog was placed in a wheel that was connected to the spit, so when the dog was moving the spit would turn and the meat was cooked evenly.

These dogs were kept in pairs so they could divide the work. In England they have the saying: "Every dog has his day" which most likely derived from those dogs. As you can expect people weren't as friendly as now. So when the dog didn't want to walk anymore they placed some of the hot coals inside the wheel so he had to walk to dodge them.

The dogs that couldn't do the work anymore, were killed or sold for very cheap to people that brought them to church with them to keep their feet warm. When kitchens became more modernised these dogs weren't needed anymore. so the "turnspit" dog became extinct.

After the first World war Corgi's (Pembroke and Cardigan) were being showed. The development of the two breeds really started after the first breedclub, Welsh Corgi Club was founded in 1925. In that time the club excisted of members that were mostly from Pembrokeshire, with preferance of the Pembroke Welsh corgi. In that time the breed standard was written to the ideal image of the Pembroke Welsh corgi. Because the people in Cardiganshire had a preferance for their type, the Cardigan Welsh Corgi, they founded the Cardigan Welsh Corgi Club a year later. This Club still excists with the name Cardigan Welsh Corgi Association. Eventually the two breeds were split by the Kennel Club in 1934, and weren't allowed to be mixed with eachother.
Crawley Crow Coracle of Aimhi, Pembroke Welsh Corgi. c. 1956