THE GOLDEN RULE
The Golden Rule , both its positive version – "Do unto others as you would have them do unto you" – as well as its negative version – "Do not do unto others as you would not have them do unto you," expresses a universal human standard of morality and appears universally in the world’s religions. 
Two thousand years before Jesus was born, an ancient Babylonian sacred teaching said, "Do not return evil to your adversary; Requite with kindness the one who does evil to you, Maintain justice for your enemy, Be friendly to your enemy." (Akkadian Councils of Wisdom, as cited in Pritchard's Ancient Near Eastern Texts.) [Note that there is a difference between "returning evil to your enemy" versus using force and even violence, if necessary, in self-defense, as discussed further here.]
A Buddhist holy teaching written centuries before Jesus was born said: "Shame on him who strikes, greater shame on him who strikes back. Let us live happily, not hating those who hate us. Let us therefore overcome anger by kindness, evil by good, falsehood by truth."
Hillel, a great Jewish rabbi who lived just before Jesus' day, taught, "What is hateful to thee, do not to another. That is the whole law and all else is explanation." (b Shabbatt 31a; cf. Avot de R. Natan ii.26) The Positive Golden Rule is also found in Jewish literature (Mishneh Torah ii: Hilekot Abel xiv.I.)
Jesus said, "All things therefore that you want people to do to you, do thus to them." (Matthew 7:12)
Islam teaches: "That which you want for yourself, seek for mankind." (Sukhanan-i-Muhammad, 63)
A Buddhist holy teaching is: "In this world hate never yet dispelled hate. Only love dispels hate. This is the law, ancient and inexhaustible." (The Dhammapada)
In ancient China, Confucius taught, "Do not impose on others what you do not desire others to impose upon you." (Confucius, The Analects. Roughly 500 BCE.).
According to Hindu sacred literature: "Let no man do to another that which would be repugnant to himself." (Mahabharata, bk. 5, ch. 49, v. 57)
Buddhist sacred literature teaches: "Hurt not others in ways that you yourself would find hurtful." (Udanavargu, 5:18, Tibetan Dhammapada, 1983)
Historically human beings the world over have tried to shape social relations with fundamental codes of conduct such as the Golden Rule , and they sanctified these codes as an authority standing above the state or ruling regime by means of religion.
Why Is the Golden Rule So Universal?
The universality of the Golden Rule is discussed more fully here. Briefly, the Golden Rule is the basis for the mutual trust between people that is, in turn, the basis for cooperation; and without cooperation human beings cannot survive. Unlike some animals that can survive as lone individuals, relying on features of their body such as armor or claws to do so, humans can only survive by cooperation. Humans hunted successfully when they hunted in groups (like wolves). Our human newborns need to be cared for much longer than most other animal newborns, requiring cooperation between the human nursing and caring for the child and the human hunting or gathering food. Lacking fur, we need to build our shelters, which requires cooperation. The more civilization has advanced, the more our daily lives and very survival depend on cooperation. We are a social species.
The vast majority of people in human society do the work that makes that society possible, and this work is overwhelmingly cooperative. Thus farmers depend on truck drivers to get their crop to market, and depend on teachers to teach their children to read and doctors to provide medical care when needed, etc. etc.
People who do the real work of society thus intuitively understand that the Golden Rule is vital. They understand this no matter what other religious (or anti-religious) beliefs they may or may not have. This is why any religion that did not embrace the Golden Rule could never have gained widespread acceptance.
Among working class people (in the broad sense of everybody except the small oppressive ruling elites that have great wealth and privilege and power) the Golden Rule is considered the basis of morality. In virtually any gathering of ordinary people where a social decision is to be made, people defend their opinion by arguing that it is the one that is most consistent with the Golden Rule. Seldom will anybody explicitly deny the moral authority of the Golden Rule, even if they don't want to follow it.
The vast majority of people honor and respect the Golden Rule and try as best they can to apply it in the little corner of the world over which they have any real control (as this online book demonstrates). Applying the Golden Rule in our society, however is hard. It's hard because the ruling elite--that controls all of the major institutions in society and uses its power to manipulate and coerce ordinary people--attacks the Golden Rule, by its actions if not its words. The ruling elite refuses to abide by the Golden Rule and does all it can to undermine working class solidarity, which is a key expression of the Golden Rule. The fundamental conflict in society is between those who respect the Golden Rule and those who have contempt for it.
When ordinary people make an egalitarian revolution, it will be because they intend to shape all of society by the Golden Rule, and remove from power those with the opposite intent.
1.Different religions at different times have varied with respect to whether "others" referred to people of different religions or not. But regardless of whether society was conceived as universal or tribal, the Golden Rule was understood as the proper basis of behavior within it.
2. Another code of conduct found in many religions is the principle of "an eye for an eye, a tooth for a tooth" which, to many a modern ear, seems barbaric. But this principle actually was formulated as an attempt to reduce violence among people, as the following account of its origin demonstrates.
"The law of 'an eye for an eye' is usually called the law of retribution, or 'lex talionis' (Latin, lex [law] and talio [like]; the punishment is like the injury), or the law of equivalency.
1. History of the legislation. The lex talionis is found in three passages in the Old Testament (Ex. 21:23, 24; Lev. 24:19, 20; and Deut. 19:21). A similar law is found in the ancient Mesopotamian code of Hammurabi. Earlier codes legislated financial compensation for bodily injuries, but Hammurabi seems to have been the first to require physical injury for physical injury. This has led some historians to conclude that there was a time when monetary compensation redressed personal injuries because the state did not consider them to be crimes against society.
The law of equivalency was a significant development in the history of jurisprudence in the sense that what used to be a private matter between two families was now taken over by the state and considered to be criminal behavior. This fits very well with the Old Testament understanding of offenses against others as offenses against the covenant community and against the God of the covenant.
2. The principle involved. The law of equivalency was an attempt to limit the extent of a punishment and to discourage cruelty. The principle of this legislation is one of equivalency; that is to say, the punishment should correspond to the crime and should be limited to the one involved in the injury (Deut. 19:18-21).
This law was a rejection of family feuds and the spirit of revenge that led the injured party to uncontrolled attacks against the culprit and the members of his or her family (cf. Gen. 4:23). The punishment was required to fit the crime, a principle still used in modern jurisprudence." [Bible Research Institute]
3. The Golden Rule quotations and sources presented here are taken from "The Golden Rule" and Christian Apologetics by Edward T. Babinski