When God revealed to Joseph about his dream of greatness, he told his brothers, who were not happy about his dream. As a result they sold him as a slave (see Gen 37:5-28). He became a servant to a wealthy ruler, and then was thrown into a prison for a crime he did not commit (Gen 39). Joseph was freed from prison and ended up in the palace, second in command to Pharaoh, the ruler over Egypt (see Gen 41:39-46). The brothers of Joseph came to Egypt in the search for food because of famine in Canaan. When Joseph saw them, he did them good by giving them plenty of food to take back and in the end asking the whole generation of Israel to move to Egypt. Joseph's brothers were afraid he would never forgive them for selling him as a slave. In Gen 50:20, we see how Joseph had a good and loving attitude towards his brothers and assured them that he had forgiven their wrong doing. They meant evil for him but God turned it into good. The way to defeat evil is by overcoming it with good. When people hurt us, we are not to get back at them for what they have done to us. I encourage you to forgive anyone that has ever hurt you, and begin by treating them good and having a kind attitude towards them. God is our Vindicator, and He will reward you for your kindness. Overcome evil with good.
1 Peter 3:9