Also
Definition@f
f[x_?(x>=0&)]:=Sqrt[x]
f[x_]:=x
This will open a new notebook with the definitions.
Needs["GeneralUtilities`"]
PrintDefinitions@f
Global`f[PatternTest[Pattern[x, Blank[]], Function[GreaterEqual[x, 0]]]] := Sqrt @ x;
Global`f[Pattern[x, Blank[]]] := x;