What do we learn from "Poter Mayim Reishis Madon [v'Lifnei Hisgala ha'Riv Netosh]"?
Kidushin 40b: One is judged first about [casting off the yoke of] Torah (which is compared to water). Just like the judgment about Torah precedes that of other Mitzvos, also the reward for Torah - "He gave to them lands... because they guard His statutes and Torah."
Sanhedrin 6b: Once you sense what the verdict will be, you may not suggest that they compromise. Before the [verdict of] the dispute is known, you may abandon the dispute (and pursue Shalom, i.e. compromise).
Rashi: One who begins a quarrel is like one who makes a hole in a wall holding back water. The water comes out, and the hole widens. So the feud constantly increases.
R. Yonah: The beginning of a quarrel is like opening a dam blocking water. If he wants to seal it immediately, before the water breaches it, he will be able to. After the water floods and breaches the walls around it, he cannot dam it. The same applies to a quarrel. Initially he can rule over his Ru'ach to abandon the feud. Therefore, before the quarrel breaks out, abandon it!
Malbim: Madon is a pretext to have a judgment. This is like one who opens water. Before opening the pipe, he can stop the gush of water. Afterwards, he cannot stop it. The beginning of judgment is like one who wants to open contained water. The solution is, before the quarrel breaks out, the judge should abandon it, and make a compromise (refer to 17:14:1:2). Reishis Madon is before beginning the judgment, i.e. hearing the claims, before you know which way the verdict will lean.
What do we learn from "v'Lifnei Hisgala ha'Riv Netosh"?
Rashi: Before your shame breaks out, abandon the quarrel.
Malbim: Before the quarrel and claims begin at all, abandon it!