the fighting on the territory of the Reich went on until May 8th/9th 1945, the wehrmacht declared its unconditional surrender that day.
as a result, public institutions were discontinued (schools, courts, police, newspapers, political parties ...), administrative duties in the country was taken over by Ally military institutions for the time being.
the main goal of the Allies was to coordinate efforts to exchange POWs, to organize war reparation payments, examine war crimes and crimes against humanity. all that was negotiated already between ally military leaders during the war, namely in the conferences of yalta and yerevan.
civil order was to be re-established after the Peace conference that took place July 1945 in a 19th century Royal family Chateau near Berlin. however, the Allies were not able to reach a formal Peace treaty at that conference. the basic agreement was to (EDIT: continue the occupation for the time being, and) only solve imminent problems concerning international issues (and issues concerning Germany as a whole) in central institutions (Allied Controll Commission, State Minister Conference...), and leave the "how-to govern?"-question to the arbitraire of each winning power (the US, GB, the SU, France) in their respective military occupation zone. that is why the four "d"s: democratisation, denazification, demilitarisation, and dismantlement proceeded quite differently from one military occupoation zone to the next.
the events of the years 1945-1949 have all been geared towards the founding of a democratic German State. the overall disagreement between the former Allies - the last slated State Minister Conference in january 1947 failed big, they did not even convene and the date of the next conference was to be set there - resulted in a split effort in that regard.
the US and GB military administration zones in Western Germany were unified in July 1947 - creating Bizony or Trizony after the chiming in of France later that year). the introduction of a new currency (the DeutschMark) in Trizony, (once more against all prior efforts to avoid the division), resulted into the Blockade of Western Berlin. as part of the agreements reached during the war, the German capital was separated into military sectors to ensure the presence of all Allies in the capital, while the town itself was situated in the middle of the Soviet occupation zone. during the Blockade Soviet military closed all entry points (EDIT: on the ground, on water, on rails) into and outta the sectors controlled by the other Allies. one last attempt to hook into a possible One-State-Solution. the blockade went on for 14 months, it ended literally on the eve of the founding of the Federal Republic (formally: the day of the new Constitution).
what happened TO germany in those years? well, its territory was reduced, the Nuremberg War Crime Trials were held. the first winter of 1945-46 was allegedly very cold, i guess that's was marked the end of the German forests or whatever was left of it ;) hm... international status of Germany, of either remnant state remained unclear for decades. both became members of the UN on the same day only in 1974 - a final Peace regulation was not achieved before 1990. hm, the European Recovery Plan - an effort to revive war-struck national economies of non-socialistic european countries with the help of immense loans from US-Federal Bank - was a huge success in Western Germany from 1946 onward - that and being relieved of War Reparation payments to the US and being relieved of having its heavy industry dismantled.
i hope all that does not sound like there was no German person involved in the building of the two states. not every German was persecuted for being a Nazi scum criminal after the war. many antifaschists returned from exile. while Allied military retained a final say in all, civil order was restored very soon with the help of German nationals.