In a method and apparatus for acquiring a magnetic resonance imaging dataset of an area to be examined of a patient by magnetic resonance data are acquired over a prespecified acquisition period which has been fixed for the acquisition process. This acquisition period is divided into a number of sub-periods. For each sub-dataset of the magnetic resonance data acquired by undersampling in a sub-period, at least one motion value describing the motion status of the area to be examined is determined, and the data subsets to be used for the reconstruction of the magnetic resonance imaging dataset are selected in dependence on the motion values in order to minimize motion artifacts.