It depends, in part, on how quickly you can find another job. On the one hand, as a programmer, you may be fortunate enough to be able to hop jobs until you find one that makes you happy. You spend a lot of your life at work. If something is making you miserable, and you can do better, why not?
On the other hand, any change is a crapshoot, so if the price of change is high, you'll need to evaluate the cost to benefit. That will depend on your location, your skillset, and your personality. That's something you'll have to discover for yourself.
Like you, I've got little tolerance for hostile people. They cost me a lot, mentally, and I take pains to avoid them. Often, they consider themselves justified, and consider it your responsibility to adapt to their style rather than the other way around.
So if you're unhappy, and fortunate enough to have the power to leave, you can at least ask your teammates and management to help you find a better solution without leaving. They likely spent a lot to hire you and would rather not train your replacement. If nobody else on the team wants to work with them, then maybe they need a change in the team, and not starting with you.
And if that's not possible, you take what steps you need to stay sane. Work isn't always pleasant, but it doesn't need to suffer from people making it unnecesarily harder.
Good luck.