I came up with this process when I needed to compile the latest commit of Sway to test a new feature, and my distro (NixOS) didn't have the required wlroots version packaged so I needed to compile that too. Here are the commands I ran for each repo:
git clone https://gitlab.freedesktop.org/wlroots/wlroots