I had carpal tunnel syndrome in my wrists and tendonitis in my elbows, pretty badly, years ago. (I felt that pain; I don't want any of my friends to feel it!) I'm a pianist, and it comes with territory if you use your muscles incorrectly. Please don't accept pain as a necessary evil.
I look at hands for six - twelve hours a day, and am a little bit of an expert at spotting tension and correcting it. Unfortunately, I can't see you through the computer! Below I've listed the best tips I can just list, without seeing your hands.
The number one most important thing you can do to help your hands, is to be sure to ALWAYS FEEL LOOSE AND EASY inside your wrists, hands, and arms while typing/playing.
It is possible to type for hours and hours, day in and day out without pain.
Carpal Tunnel Syndrome and Tendonitis are not a life sentence. I can't believe how many people I've run into that think (and are told!) that they have to put up with this forever, and that they have to quit typing or quit playing piano.
Prevention is the best 'cure' for tendonitis for carpal tunnel syndrome. Once you're in pain, though, you can use the pain as an indicator for when you're using incorrect technique. Find a way to type without the pain. Use the pain as feedback to help you know when you're using your muscles incorrectly. You will not feel pain when you're using them incorrectly.
Healthy Technique #1:
When you type make sure that from the outside elbow, to the pinky, are in a straight line. The wrist should not be at any angle from the pinky to the forearm. Look for a straight line.
This is easier with an ergonomic keyboard, but it is possible for regular keyboard, too. Make sure your forearms form a triangle rather than the forearms typing parallel to each other.
Healthy Technique #2:
Keep your wrists up. This is the tricky bit. I'm not advocating using tension to do this, but resting the wrists on something creates a 'valley,' which is very bad for your wrists. We want a flat plain, not a valley, and not a hill. Your wrists should be on level with the back of the hand.
Healthy Technique #3:
Fingers were made for closing around an object, not for lifting up. Before you strike a key, do not pull your finger up to aim. Keep your fingers close to the keyboard and grazing the keys at all times. Again, do not do this in a 'tense' way. Just let your fingers relax.
Healthy Technique #4:
Memorize the 'correct' feeling. Hold your arm up, and let your hand and fingers dangle from your wrist. Feel how loose it is? How easy and relaxed to move your hand around? This is how your hand should feel while typing.
Notice when and where you feel tension, and change what you're doing until it feel easy. Typing/playing should feel good (not just pain-free), like a nice massage to your hands and fingers and forearms.
Healthy Technique #5:
Before you type, make sure your muscles are loose and warm. Funny enough, moving your fingers has been proven to make your hands colder. Instead, move your arms in great big circles, until your fingers and arms are glowing with warmth. Also, run your forearms and hands under hot water--I go for scalding hot water until my arms are red and tears are in my eyes. That's just me, though.
If at any time, your fingers/arms grow cold, repeat the large body movements and the hot water so that the muscles stay loose and warm.
Healthy Technique #6:
Stretch every fifteen - thirty minutes. Listen to your body; you'll know when you need to stretch. Again, never stretch or use cold muscles. Make sure they're warm!
Healthy Technique #7:
Sit comfortably. Let your arms hang from your shoulders comfortably.
If You're Already Hurt:
I know I said to use your pain as an indicator and feedback, but I should mention that you will probably feel weather changes, too. Also, taking several days or weeks off, will make it worse. It'll feel fine while you're on the break, but when you go back, you'll feel pain again. After about five - six years, if you're typing correctly, you'll no longer feel these things. It takes a long time to completely cure, but you can type without pain almost immediately, as long as you avoid the movements and muscles that are causing you pain.
Taking an anti-inflammatory will help, and icing the affected areas can help after you do the work. Before, though, it's important to use hot water to help you loosen the muscles and keep them warm while you work.
You must rebuild your habits from scratch. The way you type and the muscles you use are a habit, and it will take a lot of attention to change what you usually don't consider in the first place. It's worth it, though!
It's so important to listen to your body, and remember that it's possible to type without pain. If you live around me, I'll be happy to watch you type and help you! Or if we see each other at a conference. Feel free to leave a question in the comments, or gmail me at spyscribbler.
Disclaimer: I'm not a doctor. Holding the arms and hands in the correct position is possible to do both with and without tension. One will hurt, one will not. You have to listen to your own body, your own judgement, and talk with your own doctor. I accept no responsibility for what you do at home. (Although, if I ever see you, I'm happy to help and watch and fix!)