[gitlab/devtools] Install specific branch from locally stored R project

Hi Posit Community.

Apologies if this is in the documentation and I simply missed it, but I was wondering how to structure a devtools call to install a specific branch of a locally stored R project that is a package I'm actively updating.

So far, I have been just calling the branch from gitlab after downloading the specific branch using the following:

In bash terminal:

git clone -b dev https://gitlab.<group>.org/<package_under_development>.git

In R terminal

library(devtools)
package_under_development = devtools::build("~/path/to/<package_under_development>")
devtools::install_local(package_under_development)

But going forward, I will be updating the package in one project folder and installing and running it in another project folder on the same server.

As it's good practice to test in a dev branch before merging to the main one, I'd like to know what shape a devtools call would take to install the package from my local copy of the other git-backed project specific to the dev branch.

The only the install_git call seemed to have a specific branch argument and the none of the others including install_local did not seem to have this.

Any advice on how to structure this would be greatly appreciated.

Thank you in advance!
-Thomas