A retaining device adapted for use with a nail gun, the nail gun including a frame, and a flywheel that is rotatably mounted to the frame, said retaining device including a swing arm unit that is adapted to be pivoted to the frame, and that is adapted to swing relative to the frame between a proximate position, where said swing arm unit is proximate to said flywheel, and a distal position, where said swing arm unit is distal from the flywheel, an impact unit that is movably connected to said swing arm unit, that is adapted to swing with said swing arm unit relative to the frame, and that is movable in a striking direction, and a retrieving direction opposite to the striking direction between a pre-striking position, where said impact unit is proximate to said flywheel, and a striking position, where said impact unit is distal from said flywheel, a retrieving unit that is connected between said impact unit and said swing arm unit, and that is configured to bias said impact unit to move in the retrieving direction to the pre-striking position, and a positioning unit that includes at least one first positioning member non-movably connected to said swing arm unit and extending along the striking direction, and at least one second positioning member non-movably connected to said impact unit, and extending along the striking direction, characterized in that: said at least one second positioning member of said positioning unit is configured to be telescopically engaged with and in frictional contact with said at least one first positioning member when said impact unit is moving from the striking position towards the pre-striking position, so as to position said impact unit on said swing arm unit. a swing arm unit that is adapted to be pivoted to the frame, and that is adapted to swing relative to the frame between a proximate position, where said swing arm unit is proximate to said flywheel, and a distal position, where said swing arm unit is distal from the flywheel, an impact unit that is movably connected to said swing arm unit, that is adapted to swing with said swing arm unit relative to the frame, and that is movable in a striking direction, and a retrieving direction opposite to the striking direction between a pre-striking position, where said impact unit is proximate to said flywheel, and a striking position, where said impact unit is distal from said flywheel, a retrieving unit that is connected between said impact unit and said swing arm unit, and that is configured to bias said impact unit to move in the retrieving direction to the pre-striking position, and a positioning unit that includes at least one first positioning member non-movably connected to said swing arm unit and extending along the striking direction, and at least one second positioning member non-movably connected to said impact unit, and extending along the striking direction, characterized in that: at least one first positioning member non-movably connected to said swing arm unit and extending along the striking direction, and at least one second positioning member non-movably connected to said impact unit, and extending along the striking direction, characterized in that: said at least one second positioning member of said positioning unit is configured to be telescopically engaged with and in frictional contact with said at least one first positioning member when said impact unit is moving from the striking position towards the pre-striking position, so as to position said impact unit on said swing arm unit.