Bunny hop onto a rail/ledge.
Land your back peg on, but not you front one.
Balance.
To get out either move your weight off the rail/ledge and pull the bike off with you or kind of pogo off. Shifting your weight is easier.