Most likely you are holding your needles too tightly..I'm guilty of the same things sometimes, especially if I am learning something new, then my shoulder join in and try to become earrings!
In addition to trying to be more aware of your body mechanics while knitting, try doing some massage on your hands. Massage in between your finger bones on the top of your hands and massage your knuckles as well. Keep it gentle, you don't want to make things worse. I have found that an essential oil called Cypress (available at a good health food store or co-op) is helpful for swelling as well. Mix a few drops with a little olive oil or whatever else you have on hand and rub it on the swollen area. A nice hand soak in warm water fells good too.