Gotra is the clan system. Generally its the group of people of several generations who are the descendants of a unbroken male line from a common male ancestor.
At the birth, children get gotra from their father. But a girl gets transfer to her husband’s gotra after her marriage. We can also see some rare examples of people changing their gotra doing some rituals. It is said that the great king of Nepal Prithibhi Narayan Shah(1723-75) went to Banaras, India and changed his Gotra from ‘Bharadwaj’ to ‘Kasyap’ to remain free from the sin of ‘Gotra Hatya’(killing of own clan) during unification of Nepal.