I'd use git in this case, I am sure there are other reasons to use overleaf otherwise it wouldn't exist but this seems like a solved issue with git.