They eat the thorns and leaves of the Acacia trees.
In my trusted reference book, "Behavior Guide to African Mammals", Richard Estes explains how the giraffe is able to do this: "Horny papillae (small bumps) protect the lips and tongue against thorns. The narrow muzzle, extremely flexible upper lip, and long, prehensile tongue enable the giraffe to strip leaves off branches or select individual leaflets from between sharp thorns; thus it can both feed selectively and consume the quantity of foliage needed to sustain its bulk."