Khmelnitsky Uprising was an event that in many ways defined modern Ukraine as the country we know today. Events and decisions of that time continue to echo in Ukraine even nowadays. There are many lies connected to these events as well. Russia twisted many historical facts to suit its imperial ambitions and misinterpreted these events as war for unification with Moscow rather than war for independence that it actually was. So here I will retell the story and connect it to modern times.
Before the uprising Bogdan Khmelnytsky was a nobleman in a Polish Lithuanian state, he owned land and was doing pretty well. However, some of his neighbors coveted his land and used their connection in the Commonwealth government to disposes Khmelnytsky. Frustrated Khmelnitsky decided not to take this offence lightly and due to lack of legal avenues to dispute it decided to rely on military force, Zaporozhian Cossacks. Khmelnitsky made his way into the Sich and convinced Cossacks to join his uprising against Polish Lithuanian government.
Zaporozhian Cossacks had their own grievances against the government. Number of Cossacks in Sich is ever increasing but government refuses to expand its payroll and pay them all, dividing Cossacks into paid registered Cossacks and unpaid unregistered ones. Appearance of Khmelnitsky galvanized them into action.
The final ingredient of the uprising was Crimean Tatars who also agreed to support Khmelnitsky and the Cossacks. Polish government paid Cossacks to keep Tatars at bay. However, Cossacks had more nuanced relationship with Tatars, with whom their shared steppe lifestyle and its many hardships as Polish government lived cozily in Warsaw. However, Tatars supported Cossacks mostly for the opportunity to pillage. Both Tatars and Cossacks supplemented their income with well-organized military raids on their many neighbors.
With that a joint Cossack-Tatar army took on the Polish Lithuanian State. At first demands of Cossacks and Khmelnitsky were modest. Khmelnitsky wanted his lands restored and Cossacks wanted to expand the register of Cossacks paid by Polish state to three times of it then current size.
Polish state ignored them, believing their regular troops would me more than enough to stop them. They were not enough. After several victories over government Khmelnitsky managed to take Kyiv. That made him think that as things stands there is no point in asking for a few concessions from Polish state when he can have as state of his own. With that Khmelnitsky declared himself Hetman of all Rus'. Back then Ukraine was called Rus' and what is now Russia was called Muscovy.
War continued and ended with Khmelnitsky total victory. In a peace treaty Polish King had to recognize him as Hetman of Rus' on both left and right banks of Dnipro. That territory was less than what modern Ukraine, it notably excluded both Lviv and Kharkiv, has but was very significant. Happy End?
Not so much. Polish King used peace treaty as a stopgap measure to consolidate its military and strike a deal with Tatars. In less than year hostilities resumed, and this time joint Polish Tatar Army was pushing Cossacks back. Tatars found it convenient to play both sides against each other. Khmelnitsky tried to make Tatars switch back to his cause but ultimately failed. Eventually Tatars committed themselves to Polish cause of returning it all to how it was before the uprising.
Khmelnitsky urgently needed something to supplement his army instead treacherous Tatars. If he would not find some help urgently, Poles would win and hang him and his close allies in the middle of Kyiv. There was only one other force in the area that could be willing to lend soldiers to his cause and that was Muscovy.
Moscow was a longtime rival of Polish Lithuanian State and fought many wars against them. Most of these typically end up in Smolensk switching sides again and again and sometimes with other minor territorial adjustments. Smolensk was changing countries near as regularly as US changes its Presidents.
However, Moscow wanted much more than just Smolensk but could not win it with their own military alone. Because of that Khmelnitsky thought they would be willing to help Cossacks in exchange of some land from the Poles.
Khmelnitsky send his envoys to Moscow in an attempt to negotiate an alliance. That went not so well. It's not that Moscow was not willing to help but it was the conditions they placed on their help. Moscow seemed realized that Khmelnitsky is desperate, so they decided to demand a lot.
Moscow Knyaz recently started calling himself Tsar of All Rus and therefore wished to annex all former lands of the former Rus of the past, including the entirety Khmelnitsky's state. Khmelnitsky of course would not just hand it over.
However, Moscow could not beat Poland without Cossacks just as much as Khmelnitsky could not win against Polish Tatar joint army on his own. Thus, after extensive negotiations and compromise finding they reached a deal.
The deal functioned much like Hong Kong in one country two systems arrangement with China. Tsar would appoint Hetman of Zaporozhian army but only out of people elected by Cossack elders. Hetman would be subordinate to Tsar but be free to run his country as he sees fit. There is a lot more in that document.
Moscow insisted that population of territory under Hetman control will swear allegiance to the Tsar, the part of the Pereiaslav Agreement that Russia later glorified as proof of "voluntary" union as they carefully overlooked the rest of the agreement.
One peculiar detail that important even today is the fact that Moscow insisted that Hetman do not call his country Rus' as they did not want there to be two Rus' like North and South Korea. Thus, in agreement, it is called Territory of All Great Zaporozhian Army. A clear snub wording from a Hetman that shows he is only signing it for the lack of better options. Historians typically call this state Hetmanate.
Moscow aims with the treaty were to eventually annex all of the Ukraine. They viewed the agreement as a temporary concession to Cossacks and Khmelnitsky and planned to later phase out Hetman and Cossacks and turn their territory into regular provinces.
Cossacks plans were even simpler. They though to promise just enough to get Moscow Army on their side and once it's all over and they win to simply screw the Muscovites. Because what they going to do about that: invade and fight Cossacks on their own soil?
Despite that the agreement worked and Moscow army joined Cossacks in their war. The war soon turned much bigger that either Khmelnitsky or Moscow has anticipated. At one point Sweden and Moscow nearly conquered all of Poland Lithuania but then Moscow went against Swedes helped Poles to regain their land. At the same time Ottoman Empire with its vassals interfered. The Deluge as Poles called it needs its own article to fully cover it.
Concerning Ukraine in particular sometime during the Deluge Moscow and Poland made a deal to split Ukraine along the Dnipro and eventually made it official in Treaty of Andrusovo. Cossacks felt betrayed because they were not even involved in the negotiations or signing. In contrast Moscow managed to make its vision of annexation of Ukraine closer to reality by making Poland treat Cossacks as mere subordinates who have no say in geo-political matters.
Split Hetmanate was much weaker than in its original borders. Both left and right back had their own Hetman who controlled half to Cossack army each. Neither or these halves were strong to take on either Poland or Muscovy on its own. At times Cossacks tried to elect the same Hetman on both sides to unite the Hetmanate, but Moscow and Poland would interfere and prevent him from taking control. At one point even Ottomans would interfere on behalf of Cossacks. Overall peace between Poland and Muscovy meant a civil war between Cossacks and therefore called The_Ruin.
However, while foreign powers did meddle in Hetmanate affairs, local ambitious leaders squabbled with each other and often allied themselves with either Poland, Russia or even Ottomans to help them take control of the whole Hetmanate. All that further fumed the flames of war during The Ruin. At the end of Ruin Hetmanate was still divided on the Dnipro River. Poland abolished Hetmanate on its right bank and Muscovy planned to do the same eventually.
The last major event that could have changed fate of Hetmanate was Great Northern War. When Charles XII of Sweden defeated Russian Army of Peter I of Russia. Then Hetman, Ivan Mazepa, thought it was his chance to realize the original goal of Khmelnitsky Uprising, independence. Charles XII did not want to control Hetman's territory and was happy to recognize independence of Hetmanate in exchange for Mazepa and Cossacks joining the war on his side. Mazepa had his deal.
However, things started to get worse from there on. Moscow influence in Hetmanate was already too strong, and too many Cossacks deserted Mazepa to Peter I army. Mazepa continued with the alliance though.
Charles XII brought his army into Hetmanate to spend winter in resupply in Poltava, but city unexpectedly deserted to Peter I and let his army in before Charles XII and Mazepa armies could get inside. Charles XII then tried to take city by force and almost won, but to no avail. Charles XII escaped even if his army has surrendered to Peter I and Sweden effectively lost what is now St Peterburg, Riga, Estonia and eastern Latvia.
Mazepa fled with Charles XII and without him or his supporters Hetmanate was at near complete mercy of Russians. Due to dysfunctionality of Russian state, Hetmanate continued semi-autonomous existence for another 60 years before it was gradually abolished and turned into regular Russian governorates.
Despite that idea that Ukraine is a separate country, and Ukrainians are separate people from Russians continued despite Russian efforts to promote unified identity. Eventually Ukraine re-emerged as an independent nation with a new name, as its original one because so associated with Muscovy that using it would give everyone false sense of loyalism to Moscow.