The safest way to do it is to open the brake bleeder nipple on the caliper enough to bleed off the excess fluid as you compress the caliper. That prevents back pressure into the ABS system. A hose on the nipple will prevent a spill.
Some vehicles require you to turn the piston while pushing it back in. I know my brothers Hyundai tiburon was this way. We tried for quite a while before figuring this out. Just give it a twist and use a c clamp or vise grips to compress the piston.
I use a large C clamp to push them back before installing pads. I have never had a problem with this method and I don't have to bleed the brakes.
You may need to ask someone who know in more detail