In Hindu culture, the term gotra (Sanskrit: गोत्र) is considered to be equivalent to lineage. 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, are seven sages (also known as saptarishi); the progeny of these seven sages are 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.Gautama and Bharadvāja, Viśvāmitra and Jamadagni, Vashishtha and Kaśhyapa and Shandilya
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 is 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 terms, 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).
All members of a particular gotra are believed to possess certain common characteristics by way of nature or profession. Many theories have been propounded to explain this system. According to the vedic theories, the Brahmins are direct descendants of seven sages who are believed to be the sons of Brahma, borne out of his mind through yogic prowess. They are (1) Gautama Maharishi, (2) Bharadwaja, (3) Vishvamitra, (4) Jamadagni, (5) Vashista, (6) Kashyapa and (7) Atri . To this list, Agastya is also sometimes added. These eight sages are called gotrakarins, from whom all 49 gotras (especially of the Brahmins) have evolved. For instance, from Atri sprang the Atreya and Gavisthiras gotras.
According to Robert Vane Russell, many gotra of hindu caste are of totemic origin which are named after plants, animals and natural objects. These are universal among non-aryan or primitive tribes, but occurs also in Hindu castes. The commonest totem names are those of animals, including several which are held sacred by hindus, as bagh or nahar, the tiger; bachas, the calf; murkuria, the peacock; kachhua or limun, the tortoise; nagas, the cobra; hasti, the elephant; bhainsa, the buffalo; richaria, the bear; Kuliha, the Jackal, kurura, the dog; karsayal, the dear; hiran, the black-buck and so on. The utmost variety of names is found, and numerous trees, as well as rice and other crops, salt, sandalwood, cucumber, pepper, and some household implements such as pestle, rolling slab, serves as name of clans. Thus name of the rishis or saints, Bharadwaj means a lark, Kaushik means descended from Kusha, Agastya from agasti flower, Kashyapa from kachhap a tortoise, Taittiri from titar a partridge. Similarly the origin of other rishis is attributed to animals, Rishyasringa to an antilope, Mandavya to a frog, Kanada to an owl. The usual characteristic of totemism is that the member of clan regard themselves as related to or desendend from, the animals or trees which the clan takes its name, and abstain from killing or eating it.
A gotra must be distinguished from a kula. A kula is equal to a particular family , or equal to modern day "clans", Kula does relate to lineage or caste.
Marriages within the gotra ('sagotra' marriages) are not permitted under the rule of exogamy in the traditional matrimonial system. The compound word 'sagotra' is a union of the words 'sa' and 'gotra', where 'sa' means same or similar. It is common practice in preparation for Hindu marriage to inquire about the kula-gotra (meaning clan lineage) of the bride and groom before approving the marriage. People within the gotra are regarded as siblings and marrying such a person would be thought of as taboo. In almost all Hindu families, marriage within the same gotra is not encouraged or practised since they are believed to be descended from the same family. Marriages between different gotras are therefore encouraged. But marriage within the jaati is allowed and even preferred.
For example, Jats and Rajputs have 3000 Gotras and Mudirajas of Andhra Pradesh and Tamil Nadu have 2600 Gotras. Gotra is always passed on from father to children among most Hindus. However, among the Malayali and Tulu people it is passed on from mother to child.
The tatsama words 'sahodara' (brother) and 'sahodari' (sister) derive their roots from the Sanskrit word 'saha udara' (सहोदर) meaning co-uterine or born of the same womb. In communities where gotra membership passed from father to children, marriages were allowed between a woman and her maternal uncle, while such marriages were forbidden in matrilineal communities, like Thiyyars and Tuluvas, where gotra membership was passed down from the mother.
A much more common characteristic of South Indian Hindu society is permission for marriage between cross-cousins (children of brother and sister) as they are of different gotras. Thus, a man is allowed to marry his maternal uncle's daughter or his paternal aunt's daughter, but is not allowed to marry his paternal uncle's daughter. She would be considered a parallel cousin, of the same gotra, and therefore to be treated as a sister.
North Indian Hindu society not only follows the rules of gotra for marriages, but also has many regulations which go beyond the basic definition of gotra and has a broader definition of incest. Some communities in North India do not allow marriage with certain other clans, based on the belief that both clans are of the same patrilineal descent. In other communities, marriage within the gotra of the mother's father, and possibly some others, is prohibited.
A possible workaround for sagotra marriages is to perform a 'Dathu' (adoption) of the bride to a family of different gotra (usually dathu is given to the bride's maternal uncle who belongs to different gotra by the same rule) and let them perform the 'Kanyadanam' ('kanya' (girl) + 'danam' (to give)). Such workarounds are used in rare cases, and the acceptability is questionable.
The Vedic Hinduism recognises eight types of marriages, thus predominantly follows the principles as stated in the , referring to 8 types of marriages, the roles and responsibilities of husband and wife and the purpose of marriage. Eight types of marriages are, (1) Brahma Vivaha, (2) Arsa Vivaha, (3) Daiva Vivaha, (4) Prajapatya Vivaha, (5) Gandharva Vivaha, (6) Asura Vivaha, (7) Rakshasa Vivaha, and (8) Paishacha Vivaha. The first four types of marriages reflect the paradigm behind arranged marriages. The last three are prohibited as per Manu Smriti, out of which the last two are condemned. The Gandharva marriage is an analogy to the modern day love marriages, where the individuals have the liberty to choose their partners. Though Gandharva marriage had its due prominence in our Shahstras, but with advancement of time, Vedic Hinduism giving way to classic Hinduism, the concept of arranged marriage rose to prominence, which till today is predominant ritual for a marriage between two individuals.
The Gotra system had significant contribution in preventing genetic abnormalities since its inception thousands of years ago. If child to same parent or close relative is married than recessive gene may accumulate and express themselves for it's harmful effect (eg Haemophilia) However, there is no harm in Sagotra marriage, if the individuals are not related to six generations both from maternal and paternal side, as brought out in chapter 5 of Manu smriti at mantra 60, which states, सपिण्डता तु पुरुषे सप्तमे विनिवर्तते । समानोदकभावस्तु जन्मनाम्नोरवेदने, which means that sapinda ends after seventh generations. Section 5(v) of Hindu Marriage Act 1955 also prohibits sapinda relationship but there is no restriction of Sagotra marriage. 
With nuclear families and large scale migration, in search of job or business opportunities or otherwise, it is possible that one may not know his/her gotra. Even if it is known, there is hardly any way to prove its authenticity.  Under current situation, it is impractical to follow the principles of restrictions on sagotra marriage but legal provision under Hindu Marriage Act are more appropriate to refrain from Sapinda marriage.
While the gotras are almost universally used for determining excluding marriages that would be traditionally incestuous, they are not legally recognized as such, although those within "degrees of prohibited relationship" or are "sapinda" are not permitted to marry. Khap panchayats in Haryana have campaigned to legally ban marriages within the same gotra. A convener of the Kadyan Khap, Naresh Kadyan, petitioned the courts to seek amendment to the Hindu Marriage Act to legally prohibit such marriages. However, the petition was dismissed as withdrawn after being vacated, with the Delhi High Court warning that the Khap would face heavy penalty costs for wasting the time of the court.
In the 1945 court case of Madhavrao vs Raghavendrarao, which involved a Deshastha Brahmin couple, the definition of gotra as descending from eight sages and then branching out to several families was thrown out by the Bombay High Court. The court called the idea of Brahmin families descending from an unbroken line of common ancestors as indicated by the names of their respective gotras "impossible to accept." The court consulted relevant Hindu texts and stressed the need for Hindu society and law to keep up with the times, emphasising that notions of good social behaviour and the general ideology of the Hindu society had changed. The court also said that the mass of material in the Hindu texts is so vast and so full of contradictions that it is a near-impossible task to reduce it to order and coherence.