When a crystal is subjected to a periodic potential, under certain circumstances it can adjust itself to follow the periodicity of the potential, resulting in a commensurate state. Of particular interest are topological defects between the two commensurate phases, such as solitons and domain walls. Here we report a commensurate-incommensurate transition for graphene on top of hexagonal boron nitride (hBN). Depending on the rotation angle between the lattices of the two crystals, graphene can either stretch to adapt to a slightly different hBN periodicity (for small angles, resulting in a commensurate state) or exhibit little adjustment (the incommensurate state). In the commensurate state, areas with matching lattice constants are separated by domain walls that accumulate the generated strain. Such soliton-like objects are not only of significant fundamental interest, but their presence could also explain recent experiments where electronic and optical properties of graphene-hBN heterostructures were observed to be considerably altered. © 2014 Macmillan Publishers Limited. All rights reserved.