The plasma heating during collisionless magnetic reconnection is investigated using particle-in-cell simulations. We analyze the time evolution of the plasma temperature associated with the motion of the reconnecting flux tube, where the plasma temperature is defined as the second-order moment of the velocity distribution function in the simulation frame/in the center of the flux tube frame, and we show that the plasma heating during magnetic reconnection can be separated into two distinct stages: the nonadiabatic heating stage, in which the magnetic field lines are just reconnecting in the X-type diffusion region, and the adiabatic heating stage, in which the flux tube is shrinking after two flux tubes merge. During the adiabatic heating stage, the plasma temperature T can be approximated by TV gamma-1 = const., where gamma = 5/3 is the specific heat, and V is the volume of the flux tube. In the nonadiabatic heating stage, we found numerically that the ratio of the increment of the ion temperature to that of the electron temperature can be approximated by Delta T-i/Delta T-e approximate to (m(i)/m(e))(1/4), where m, and m e are the ion and electron masses, respectively. We also present a theoretical model based on a magnetic-diffusion-dominated reconnection to explain the simulation result.