It depends on which particular legion you're talking about. Despite the narrative that's still often taught in high schools, that legions were unwaveringly loyal to their generals, in fact the various civil wars saw as many troops mutinying and defecting as anything else. By the time of Caesar's death in March 44 his army included fourteen legions, which were preparing for the Parthian Expedition. None of these legions had existed when Caesar first entered Transalpine Gaul in 58, and only one had taken any part in the Gallic War at all. In 59 Caesar, as a proconsul, had been given four legions, the Seventh through Tenth. By early in 58 he had raised another two, the Eleventh and Twelfth, and by the end of 57 he also had the Thirteenth and Fourteenth. These eight legions were his main force during most of the time he spent in Gaul, with a few additions. In 53 during Ambiorix's revolt Caesar was sent a consular legion (I-IV), the First, which he returned in 50. During Vercingetorix's revolt in 52 he raised two legions, probably mostly from Cisalpine Gauls, the Fifth and Sixth. When the Fourteenth was mauled by Ambiorix early in 53 and had to be rebuilt Caesar also raised a Fifteenth legion, which in 50 he sent to Italy for use in the east--instead, the senate intended to use it on him, and the legion defected to the Caesarians early in 49. The civil war saw some massive enlistments, but the point of all this is that the vast majority of Caesar's legions had ceased to exist in 44. All his Gallic veterans besides the Fifth had been disbanded. Of his four consular legions, raised in 48 for the civil war, only the First and Third had been involved in fighting. The Sixteenth Legion, raised in 49 for the civil war, was destroyed immediately the next year. The Seventeenth through Forty-Seventh Legions, some of which were actually Pompeians, are pretty obscure.
Anyway, a lot happened between 44 and 31. During the first break between Antony and Octavius at Mutina we see Caesarian veterans on both sides. The Third Legion, for example, was one of the legions that defected to Octavian and constituted his illegal private army before he was granted extraordinary magistracy. The Second (which might not have seen combat in the civil war) sided with Antony at Mutina. The Fifth sided with Antony and in 42 was essentially disbanded to allow its veterans to settle their plots--the legion was maintained from new recruitment, however, and participated in Antony's ill-fated Parthian Expedition. The Fifth brings us to an important point: the Caesarian legions had largely been disbanded in 44. Some settled veterans apparently threw their lot in with one side or another in 44/43--the veterans of the Seventh, for example, mostly voluntarily joined Octavian's illegal force, although they probably did not exist as a full legion until Philippi. The case of the Tenth is somewhat typical. The legion was disbanded in 45 and its veterans settled. Lepidus raised it again in 43 in preparation for the triumvirs' war at Philippi, after which its veterans were again settled. The legion, which probably contained few remaining Caesarians, participated in the Parthian Expedition and sided with Antony at Actium--following Actium they defected to Octavian. So the legion, or at least one with that name, existed and fought for one side or another. But the numbering of legions did not become standardized until the Principate. The consular legions were always numbered I-IV, but there might exist multiple sets of these. Caesar entered Gaul with legions VII-X, but there was little reason why some other promagistrate elsewhere could not raise a legion with the same numbers, and it seems decidedly unlikely that Caesar could have commanded all legions from 1-47 without some other magistrate raising legions of equivalent numbers. Besides that, how many of Caesar's veteran legions really did exist at Philippi (fighting for either side, a number of them sided with the Republicans)? Several of the Gallic legions had been reconstituted by 42, but it's hard to say whether these should really be considered the same troops. The Eighth, for example, was disbanded in 45, then participated in Philippi. Its veterans were settled but the legion we know was present at Perusia (there's a sling bullet that mentions them there). The Twelfth was disbanded in 45 and reformed for Philippi. It fought at Philippi and Perusia (with Octavian) but then participated in Antony's Parthian Expedition. By then its veterans had been settled and it's hard to say whether we should really consider this a separate legion (Antony may have even called it something different, sling bullets at Perusia call it Victrix but Antony's coinage calls it Antiqua). Later it was called Fulminata, its name during the Principate--should this really be considered the same force?