Worth mentioning that if you want to remove the feed pipes to the master cylinder press and hold the brake pedal and no air (or anything else) can get into the system.
I've used this technique when fluid swapping on my bike brakes.