The twelve Earthly Branches or Terrestrial Branches are a Chinese ordering system used throughout East Asia in various contexts, including its ancient dating system, astrological traditions, zodiac and ordinals.
This system was built from observations of the orbit of Jupiter. Chinese astronomers divided the celestial circle into 12 sections to follow the orbit of 歲星 Suìxīng (Jupiter, the Year Star). Astronomers rounded the orbit of Suixing to 12 years (from 11.86). Suixing was associated with 攝提 Shètí (η Boötis) and sometimes called Sheti.
Jonathan Smith has proposed that the first meanings of the earthly branches, predating the Shang dynasty, were phases of the moon, with the heavenly stems at that point referring to divisions of the ecliptic. After being adopted as a calendar these would have lost their clear lunar reference, permitting their repurposing for Jupiter stations.
In correlative thinking, the 12 years of the Jupiter cycle also identify the 12 months of the year, 12 animals (mnemonics for the system), cardinal directions, seasons, and the 12 traditional Chinese units of time in the form of periods that each day was divided into. In this case an Earthly Branch can refer to a whole period, or to the exact time at its center. For instance 午時 wǔshí can mean either noon or 11 am - 1 pm. (The jiéqì system provided single hours and 15-degree arcs in time and space.)
Chinese seasons are based on observations of the sun and stars. Many Chinese calendrical systems have started the new year on the second new moon after the winter solstice.
The Earthly Branches are today used with the Heavenly Stems in the current version of the "traditional Chinese calendar" and in Taoism. The Ganzhi (Stem-Branch) combination is a fairly new way to mark time; in the second millennium BC, during the Shang era, the 10 Heavenly Stems provided the names of the days of the week. The Branches are as old as the Stems (and according to recent archaeology may actually be older), but the Stems were tied to the ritual calendars of Chinese kings.