How to temporarily use a project's PR branch?

I would like to build and test a branch of a project for an unapproved pull request. How do I specify (temporarily only) in platformio.ini to use the branch instead of the base project?

Depending on whether it’s a platform, library, package or whatever you use the git link of the fork that the author of the PR has created in the platformio.ini.

E.g., say you wanted to use this PR: https://github.com/platformio/platform-espressif32/pull/1281

You would click on the “from sgryphon:…” link that gets you to the repo and branch, and from there you derive

platform = https://github.com/sgryphon/platform-espressif32.git#sgryphon/add-esp32-arduino-libs

as the line to use in the platformio.ini, pieced together by the <repo url>#<branch name>.

grafik

Branch name from the thing after tree/: https://github.com/sgryphon/platform-espressif32/tree/sgryphon/add-esp32-arduino-libs.

The same scheme works for lib_deps, platform_packages, etc.

Thanks, but I think I was not specific enough when describing my goal.

My complete project is based on a Github repo, the project folder is a clone of that repo. The PR now is modifying a tiny piece of that repo only, platform, libraries and whatnot are identical.

It feels like overkill to me to clone the PR’ed repo, set up a new PlatformIO project for it and build the modified project to test it, since a huge set of platform, libraries etc. would be downloaded again with no modifications at all.

So I thought there must be a less expensive way to just download the modified project and build it with what is there already. And, in case, revert to the original afterwards again.

If it’s purely about already having cloned some version of the repo, and then wanting to change over to that fork, it’s just about git commands: Change the remote to point at the PR URL and checkout the PR branch. Something along the lines

git remote remove origin
git remote add origin <URL of fork>
git checkout <branch>
; or merge or pull etc
1 Like

Ah, silly me… Of course, that will solve it.

Thanks a lot! :+1:

Erm… Not a PlatformIO thing at all, but you might be able to help me again:

I changed the remote to the fork with the changes and built and tested these. But I found no means yet to get back to my original repository, although I did as advised with the URL of it to change the remote again. And still the modified files will show up in PlatformIO?!?