The mechanics of reversible adhesion of the gecko is investigated in terms of the attachment and detachment mechanisms of the hierarchical microstructures on its toe. At the bottom of the hierarchy, we show that a spatula pad of tiny thickness can be well absorbed onto a substrate with a large surface area and a highly constrained decohesion process zone, both of which are beneficial for robust attachment. With different peeling angles, the peeling strength of a spatula pad for attachment can be 10 times larger than that for detachment. At the intermediate level of hierarchy, we show that a seta can achieve a stress level similar to that in the spatula pad by uniformly distributing adhesion forces; as a consequence, the 10 times difference in the peel-off force of a single spatula pad for attachment and detachment is magnified up to a 100 times difference in adhesion energy at the level of seta. At the top of the hierarchy, the attachment process of a gecko toe is modelled as a pad under displacement-controlled pulling, leading to an adhesive force much larger than the gecko's body weight, while the associated detachment process is modelled as a pad under peeling, resulting in a negligible peel-off force. The present work reveals, in a more systematic way than previous studies in the literature, that the hierarchical microstructures on the gecko's toe can indeed provide the gecko with robust adhesion for attachment and reversible adhesion for easy detachment at the same time.