like cadences and dance like mannerisms to prevent the trains from derailing by lining (aligning) the rails and tamping the bed of ballast beneath them.
Gandy dancer is a slang term used for early railroad workers who laid and maintained railroad tracks in the years before the work was done by machines. The early section workers were mainly African-American and Chinese Section workers, while Italians, Irish, Mexican (traqueros) and Native-Americans made up the rest.
Another theory about it's name is that the rails were heavy and made heavier as they where somewhat anchored to the ground, and typically a large crew of 8 to 12 men would move the rail together, shuffling carefully in time to the music and supposedly looking like a flock of waddling geese. This apparently led to some people calling these particular section workers "gander dancers," reference to the Geese, which was later corrupted into "Gandy dancers."
Though rail tracks were held in place by wooden ties and the mass of Ballast (crushed rock) beneath them, each pass of a train around a curve would, through centripetal force and vibration, produce a tiny shift in the tracks on each pass and over time could move the rails many feet. If allowed to accumulate, such shifts could eventually cause a derailment; work crews (the Gandy's) had to pry them back into place routinely. The dancing part would refer to the movement of the lever they used in rhythmic unison to adjust or moves the rails. The bars they used were the "dancers" and how they would make those lining pry bars dance. These Gandy songs also might be the evoution of the Blues.
... Also see Ballin' the Jack and Ring Shout, Buzzard Lope, Eagle Rock, the.