In Hindu society, the term gotra (Sanskrit: गोत्र) means clan. It broadly refers to people who are descendants in an unbroken male line from a common male ancestor or patriline. Generally the gotra forms an exogamous unit, with the marriage within the same gotra being prohibited by custom, being regarded as incest. The name of the gotra can be used as a surname, but it is different from a surname and is strictly maintained because of its importance in marriages among Hindus, especially among the higher castes. Pāṇini defines "gotra" for grammatical purposes as apatyam pautraprabhrti gotram (IV. 1. 162), which means "the word gotra denotes the progeny (of a sage) beginning with the son's son." When a person says "I am Vipparla -gotra," he means that he traces his descent from the ancient sage Vipparla by unbroken male descent.
According to the Brihadaranyaka Upanisad 2.2.6, Gautama and Bharadvāja, Viśvāmitra and Jamadagni, Vashishtha and Kaśhyapa and Shandilya are seven sages (also known as Saptarishi); the progeny of these seven sages is declared to be gotras. This enumeration of seven primary gotras seems to have been known to Pāṇini. The offspring (apatya) of these seven are gotras and others than these are called gotrâvayava.
One who follows the system defined by three sages defines himself as tri-a-rishaye. Similarly, for five sages, it is pancha-rishaye, and for seven sages, it's sapta-rishaye.
There exists another theory about gotra: sons and disciples of a sage would have the same gotra; it is believed that they possess similar thought and philosophy. People of the same gotra can be found across different castes. Each Gotra comprises pravaras.
As a Rigvedic termss, gotra simply means "cow pen" or "herd of cows". The specific meaning "family, lineage kin" (as it were "herd within an enclosure") is relatively more recent, first recorded around the mid-1st millennium BCE (e.g., Chandogya Upanishad).
These "lineages" as they developed among the Brahmins of that time meant patrilineal descent. The Brahmanic system was later adopted by other communities, such as the Kshatriyas and Vaishyas