The right tools. There is a device that will clamp the fitting down when you remove the fitting from its position. This video demonstrates the use of specialized devices to fix the issue.
All you have to do is purchase a new clamp to seal off the hose before you remove the fitting that holds the hose in place. You will get only a couple of drops of fluid regardless, but this clamp will stop an absurd amount from being spilled. Just attach the clamp to the hose, then fix the clamp.
This handy tool makes the job easier and neater. Once the work is completed then you are able to take off from the clamp and reconnect an adapter to pipe. There are clamps available in different sizes to accommodate the various fluid lines in your vehicle.
They can also block air from getting inside your car’s hoses. If your car has ABS then the clamps ought to be installed on the brake lines. They are very common in modern cars. There is no way to repair problems caused through air infiltration, unless you’re able to access the factory scan tool.
For more details, check out this video above.