We present an analysis of the clustering of galaxies from z ~ 2 to the present day using the WIRCam Deep Survey (WIRDS). WIRDS combines deep near-infrared data with the deep optical data from the CFHTLS Deep fields, providing a photometric data-set over an effective area of 2.4 sq. deg., from which accurate photometric redshifts and stellar masses can be estimated. We use the data to calculate the angular correlation function for galaxy samples split by star-formation activity, stellar mass and redshift. We estimate the real-space clustering for each sample, determining clustering lengths and power-law slopes. For galaxies selected by constant mass, we find that the clustering scale shows no evolution up to z ~ 2. Splitting the galaxy sample by mass, we see that higher mass galaxies have larger clustering scales at all redshifts. We use our results to test the GALFORM semi-analytical galaxy formation model and find the two are consistent. We split the galaxy population into passive and star-forming populations and find that the passive galaxy population shows a significantly larger clustering scale at all redshifts than the star-forming population below masses of ~$10^{11}M_odot/h$, showing that even at z ~ 2 passive galaxies exist in denser environments than the bulk of the star-forming galaxy population. For star-forming galaxies with stellar masses $>10^{11}M_odot/h$, we find a clustering strength of ~8Mpc/h across all redshifts, comparable to the measurements for the passive population. Also, for star-forming galaxies we see that clustering strength increases for higher stellar mass systems, however there is little sign of a mass dependence in passive galaxies. Finally, we investigate the connection between galaxy stellar mass and dark matter halo mass, showing a clear correlation between the two in both the WIRDS data and the GALFORM predictions.