Legend has it that king Zhou had detained Ji Fa for nineteen years and forced him to eat the flesh of his oldest son to test his loyality. When Ji Fa finally escaped back to his kingdom, he devoted herself to the undertaking of revenge. After he died, his second son king Wu started the war to overthrow the tyrant. His army, led by the famous general Jiang Zi Ya, defeated the Shang troops in the Battle of Mu Ye. King Zhou gathered all his treasures around himself in the Palace, and then set fire to his palace and committed suicide.
After the war, king Wu asked his ministers for advice on dealing with the soldiers and officials of king Zhou. Jiang Zi Ya said, "I once heard if you love someone, you are intended to love even the crows on the roof of his house (Ancient Chinese believed that crows were a kind of ominous bird whose caws forebode disaster.); if you hate someone, you are intended to hate even his attendants and servants. Those who served king Zhou were enemies fighting against us. So, we'd better kill them all. What do you say, Your Majesty?"
king Wu who was a merciful ruler did not agree with him and said: "I don't think so.".
An minister named Shao Gong took a step forward and said:" I heard that those who are guilty should be sentenced to death in order to avoid future disasters, while those who are innocent should be released. So we'd better kill the guilty ones. What do you say, Your Majesty?"
King Wu did not think it was a proper way either and thus said: "I don't think so."
Then another minister named Zhou Gong took a step forward and said:" "Your majesty, I think we should let all the prisoners go back to their home and give them fields to let them support themselves. Moreover, Your Majesty, you should treat all people, no matter whether they used to serve king Zhou bor not, the same way." King Wu thought the his proposal was quite reasonable so he accepted and followed it.
As a result, the domestic situation soon settled down and gradually the country became more stable and stronger.The idiom is then used to mean that if you love someone,you'll love people and things relative to him as well.