however, that gives me the active branch. If I am working with two branches in parallel (one which I want to use for this project, and one where I am preparing a new PR) this is not possible using this approach.
The dev command should give you the current code in the directory and no matter whether it is committed to git or not. You can still access the code in other branches by using add with the full path to the repository and appending #branchname on the end of the path even if the branch is not the current HEAD, e.g. :
] add ~/code/MyPackage.jl#devbranch2
If this is not enough, then you could either clone your local working copy or make a recursive copy of it (in Linux this is done with cp -a). But only do this if you have to, as it can get quite confusing to be working on two copies of the same code.
This will perform a local git pull to obtain the code from the repo ~/code/MyPackage.jl. The code changes in the latter folder will not be automatically tracked. Any changes need to be committed first, and then in the virtual environment where you ran Pkg.add, you need to run Pkg.update to obtain the new code. If instead, you want to automatically track code changes in ~/code/MyPackage.jl, including any committed or uncommitted changes (or even without a git repo in the folder at all), you need to run
dev is not git-aware like add is, it simply uses whatever code is in the local folder. So if you want to dev two different branches, you’ll need to make two separate clones of the repo into different folders, check out the branches you want to dev in each one, then do