Tracking charge migration with attosecond X-ray pulses from a free-electron laser