The magnetic attraction between the magnet’s atoms gets loosened when they are hammered.
Stroking one magnet with the other in an inappropriate manner will reduce the magnetic strength.
Place the permanent magnet in a solenoid which is placed along the East-West of the earth and then pass an alternating current through the coil. The alternating current will continuously reverse the polarity of the coil. This in turn will disorient the small atomic magnets of the permanent magnet and demagnetize the permanent magnets.