Never while docked unless your a commissioned ship. You know what I mean, on the transom staff or near the top of the backstay. You could stitch the flag up high on your mainsail. That would be a great tell-tail also. My flag is placed as high as I can reach on the topping lift.
Most smaller sailboats do it the same way.
Every time out I pulled the mast crutch pole and stored it below deck. No need to go all the way through, just 4 to 6 inches is plenty. Here comes the tuff part so do it very carefully. I used a propane torch. Plastic pipe is cheap.