Build multiple branches into separate directories in GitHub Pages

Hello! Is it possible to use Travis to do the following?

* The build from branch A is deployed to gh-pages in directory X.
* The build from branch B is deployed to gh-pages in directory Y.

By doing this, you’d be able to access ###.github.io/###/X, and be presented with the build. These are, of course, related, which is why I’m keeping them in the same repository.

I see the keep_history option — by using that in conjunction with targeting a specific build directory (I can modify this if absolutely necessary), it seems possible. I presume the keep_history flag only commits the files produced, and doesn’t delete the others.

Thanks!