The 30th prohibition is that we are forbidden from walking in the ways of the heretics and from acting as they do — even in their clothing and their gatherings in halls.
The source of this commandment is G‑d's statement,1 "Do not follow the customs of the nation that I am driving out before you." This prohibition is repeated in G‑d's statement,2 "Do not follow their customs," which is explained,3 "I [G‑d] have prohibited only customs which have been established by them and their ancestors."
In the words of the Sifra, "The verse,4 'Do not follow their customs,' teaches that you may not follow the social customs which they have established, such as [attending] theaters, circuses and arenas, which are places where they would gather for idol worship. Rabbi Meir says that these [customs] are the 'ways of the Amorites'5 which our Sages have listed. Rabbi Yehuda ben Beteira says that [this teaches that] one may not nocher,6 nor grow one's hair long, nor cut one's hair in "kumi"7 style."
One who does any of these is punished by lashes.
This same prohibition is repeated in a different way:8 "Be very careful lest you be entrapped after them." In the words of the Sifri, "'Be very careful' [hishomer], indicates a prohibition; 'lest' [pen], indicates a prohibition; 'you be entrapped after them,' that you might imitate them and act as they do, and it will be a stumbling block to you. One should not say, 'Since they go out wearing purple, so too I will go out wearing purple. Since they go out wearing telusin (which is a type of military ornamentation), so too I will go out wearing telusin.'"
You are certainly aware of the words of the prophet,9 "[I shall punish…] all who are wearing non-Jewish clothing." All this is to keep us far away from them, and to despise all their customs, even their dress.
The details of this mitzvah have been explained in the sixth chapter of Shabbos,10 and in Tosefta Shabbos.11