- Use proper sitting posture, change position often, stand/walk when possible.
- Use an ergonomic keyboard which avoids troublesome positions/movements.
- Exercise. In particular, do some resistance (weight) training.
Anecdotes:
- In my mid 20s emacs pinky could have done me in, but Kinesis ergonomic keyboards worked around emacs afflictions.
- In my late 30s arthritis started troubling me, but a decade later I have less pain (inconsequential) due to taking better care of my health/fitness. But on the downside 16-hour programming days are now a distant memory.
I've read many, many anecdotes over the years, and they make clear that people have diverse afflictions. Be careful about following advice that doesn't apply to your circumstances.