They are all the same tube, an octal base, with grid cap, pentagrid converter, but were first produced in the 1930s with the metal shield housing, then the shapely glass envelope, then the shapeless tubular glass envelope.
The G refers to a glass tube envelope (there are metal tubes and ceramic ones too). The initial number (5, 6, 12, etc) refers to the heater voltage (5.4V, 6.3V, 12.6V, etc.). The 6A8GT and the 12A8GT do NOT have the same heater. In fact, the heater voltage is the only difference between the two
Edit: I looked at Be an Angel's Wikipedia reference and, while well hidden, the information is there also: "Sometimes a string of up to three Roman letters can be suffixed to the overall number; these generally distinguish various revisions and improvements to the original model or different bulb shapes; use is unsystematic, except that for octal tubes G often indicated a shouldered glass envelope, GT a tubular glass envelope, and neither of these often a metal envelope. When discussing a type in general the letters are often omitted; discussion of the properties of the 6SN7 would tacitly include the 6SN7GT, 6SN7GTB, etc., but not the comparable 6SL7 family. By and large tubes with the same basic designation are interchangeable unless the qualities of an enhanced version are required."
well I looked at wikipedia https://en.wikipedia.org/wiki/List_of_vacuum_tubes and could not find the letter suffix meanings, you might find something there though.