What is the timeline of events that led to Germany's current geographic shape?
- 1871: German Empire formed
- 1919: Weimar Republic formed
Germany's borders were defined by three wars.
After its victory in the Franco-Prussian War in 1871 Germany took Alsace, and a quarter of Lorraine from France, defining its Western border.
After the Allied victory in World War I in 1918, France took back Alsace-Lorraine, some adjustments were made in Belgium's favor further north, and a 60-mile wide "Polish Corridor" was cut across Germany's holdings in the northern part of modern Poland to give that country access to the sea.
After the Allied victory in World War II in 1945, six (or rather five and a half) provinces of modern Poland east of the Oder River was carved off Germany's eastern flank and given to Poland. The remaining "half" province was the area around Koenigsberg (now Kaliningrad), and given to Russia, along with the city itself.
The initial border was drawn during the Potsdam Conference in the aftermath of the second world war, on 1945-08-02. The border was finalised by a joint East German-Polish commission in the aftermath of the Treaty of Zgorzelec on 1951-01-27. The last change happened on 1989-05-22 with redrawing of the sea border north of Usedom, gaining (then) Eastern Germany about 158 km². It became a border of Germany on the day of German reunification of 1990-10-03, and formally through the German–Polish Border Treaty of 1990 on 1992-01-16. Since the border follows two significant rivers for almost all of its length, there was no significant changes in its course since then.
The border is based on the borders of the kingdom of Bohemia and didn't change much since the 19th century. Germany shortly moved it eastward following the Munich Agreement on 1938-09-30; this was undone in the wake of the second world war. The border was finally set in stone and all territorial claims from both sides declared null and void in the Treaty of Prague on 1973-12-11.
Again, the border is based on old borders of Austria, Bavaria and other German states, and didn't change much in the last century, aside from the short period during and shortly before WWII where it didn't exist.
The border is the oldest and most stable of all German borders, dating back to the Peace of Westphalia in 1648.
As a side note, the border between Germany, Austria and Switzerland over most of Lake Constance (Bodensee) is not defined.
The border is for the most part a result of the Treaty of Versailles of 1919-06-28, with Germany losing significant parts of its territory in the south-west to France. Smaller border corrections happened throughout all of the twentieth century. The most important of those was the reunification with Saarland on 1957-01-01. In 1986-05-01 the area of Mundatwald was given back to Germany,
The rough course of the border was decided with the independence of Luxembourg at the end of the 19th century. In the case of the German part of it, it mostly followed the course as set in the Treaty of Aachen of 1816-06-26. This course was restored after WWII. The area of Kammerwald was taken temporary (1949-04-23 to 1959-07-11) from Germany. The final border course was last changed in a treaty in 1988-09-01, to account for changed river courses.
As a side note, this treaty created an area of the size of 700,92 ha (698,34 ha of it on water) which is under a joint sovereignty of both states.
Similar to the other western borders, the original borders go back to the 19th century, and were restored at the end of WWII. The last treaty correcting the border, and giving Germany about 20 km² of territory around Losheim and Fringshaus, happened on 1956-09-24. The treaty came into force on 1958-08-28.
As above, only small border changes happened after WWII, and the borders were mostly a result of the Peace of Westphalia and following treaties. In the Treaty of Settlement of 1960-04-08, most of the territories annexed by the Netherlands following WWII (areas around Elten, Selfkant and Suderwick) were returned to Germany for the price of 280 million German marks; the treaty came into force on 1963-08-01.
The island of Heligoland was given back to Germany in 1952-03-01.
The East Prussia area was lost to Poland and the Soviet Union following Second World War.
The German colonial empire was dismantled after the First World War. To quote from the Wikipedia article, since I couldn't possibly write it better myself:
In Africa, Britain and France divided German Kamerun (Cameroons) and Togoland. Belgium gained Ruanda-Urundi in northwestern German East Africa, Great Britain obtained by far the greater landmass of this colony, thus gaining the ‘missing link’ in the chain of British possessions stretching from South Africa to Egypt (Cape to Cairo), Portugal received the Kionga Triangle, a sliver of German East Africa. German South West Africa was taken under mandate by the Union of South Africa.
In the Pacific, Japan gained Germany’s islands north of the equator (the Marshall Islands, the Carolines, the Marianas, the Palau Islands) and Kiautschou in China. German Samoa was assigned to New Zealand; German New Guinea, the Bismarck Archipelago and Nauru to Australia as mandatory.
Further reading: Territorial evolution of Germany on the English Wikipedia
Germany's current geographic shape was largely formed in wars. One can go arbitrarily far into the past here but it will get very messy - unification of Germany is probably a good start, there were relatively few changes after that.