Sometimes in life and often on TV shows (especially Lost) the good guy will make a deal with the bad guy in order to not have the bad guy do something really bad. They think it will be better this way. They think if they don't do what the bad guy says then that really bad thing will be the good guy's fault! Such a false concept. Like those boyfriends that manipulate their girlfriends by saying "if you break up with me, I'll kill myself" so they stay with them cause they don't want to feel responsible for a suicide. How false of an idea!
Those that commit the wickedness are the only ones responsible for the wickedness. The righteous aren't bound to the acts of the wicked in any degree. We don't have to play these games or make these deals. This is a very manipulative act designed to make the righteous disobey God and to shift the responsibility of their unrighteousness to someone else.
Alma and Amulek puts that idea in perspective:
And when Amulek saw the pains of the women and children who were consuming in the fire, he also was pained; and he said unto Alma: How can we witness this awful scene? Therefore let us stretch forth our hands, and exercise the power of God which is in us, and save them from the flames.
But Alma said unto him: The Spirit constraineth me that I must not stretch forth mine hand; for behold the Lord receiveth them up unto himself, in glory; and he doth suffer that they may do this thing, or that the people may do this thing unto them, according to the hardness of their hearts, that the judgments which he shall exercise upon them in his wrath may be just; and the blood of the innocent shall stand as a witness against them, yea, and cry mightily against them at the last day.
We don't have to make deals with the devil for the seemingly greater good. Because they'll be judged for their own actions and we'll be judged for ours. We may think "I can't tell this person my hidden secret because it will destroy him/her and then they will do something really crazy" but that is ridiculous because its not up to us what people do with their lives. We have to respect their agency and our own. We have to trust in God and let Him judge them for their own choices.
Its not right for us to be basing our obedience to the commandments on if others will or will not obey. Also, we can't let the weight of their choices be upon ourselves.
If someone is only righteous because we did something bad for them, then they aren't righteous at all and suddenly we aren't righteous either.
If someone said to me "Hold up this bank and kill that guy or I will blow up a school bus" I wouldn't succumb to that demand because I know God would judge the wicked for their own actions and not mine. You can't say at the judgment bar "I only sinned so others wouldn't" because God gave us all free agency to choose for ourselves, good from evil. And, if people choose to do good or evil in any degree it will be to their own exaltation or damnation.
Conclusion: don't make a deal with the devil for what seems like a greater good because its not possible that anything good can come from bringing yourself down.