The rest and repair button should be active when it is in a city. The unit needs rest after combat and can do this anywhere (not move) If the unit takes hits, it can only repair at the city (or port in the ship case).
One hit point per turn when not moving in city
One point less of fatigue when not moving. It will repair before rest.