Nonadiabatic holonomic quantum computation has received increasing attention due to the merits of both robustness against control errors and high-speed implementation. A crucial step in realizing nonadiabatic holonomic quantum computation is to remove the dynamical phase from the total phase. For this reason, previous schemes of nonadiabatic holonomic quantum computation have to resort to the parallel transport condition, i.e., requiring the instantaneous dynamical phase to be always zero. In this paper, we put forward a strategy to design nonadiabatic holonomic quantum computation, which is based on a commutation relation rather than the parallel transport condition. Instead of requiring the instantaneous dynamical phase to be always zero, the dynamical part of the total phase is separated from the geometric part and then removed by properly choosing evolution parameters. This strategy enhances the flexibility to realize nonadiabatic holonomic quantum computation as the commutation relation is more relaxed than the parallel transport condition. It provides more options for realizing nonadiabatic holonomic quantum computation and hence allows us to optimize realizations such as the evolution time and evolution paths.