yarn icon indicating copy to clipboard operation
yarn copied to clipboard

Support installing a Git monorepo workspace from a specific branch or commit in Yarn v3/v4

Open ayushmahajan12 opened this issue 8 months ago β€’ 0 comments

Hi Yarn team πŸ‘‹

I'm trying to install a package from a Git monorepo using a specific workspace (subfolder), while also targeting a specific branch or commit, but I haven't found any syntax that works in Yarn v3 or v4.

Here’s my monorepo structure:

immaculate-constellation/
└── packages/
    └── mobile-audio-player/

I want to install mobile-audio-player from this monorepo, from a specific branch or commit. I’ve tried something like: yarn add mobile-audio-player@git+https://git.repo.url.git#branch:workspace=mobile-audio-player

But this results in the error: Invalid Git resolution protocol ("branch") or isn't supported by any available resolver

βœ… This works (only from the default branch): yarn add mobile-audio-player@https://git.repo.url.git#workspace=mobile-audio-player

❓My question: Is there a supported way in Yarn v3 or v4 to install a workspace from a specific branch or commit of a Git monorepo?

If not, is there any recommended workaround?

This would be very helpful for testing workspace packages before merging changes into the default branch.

Any help or roadmap insight would be greatly appreciated πŸ™

Thanks in advance for all the great work!

ayushmahajan12 avatar Apr 24 '25 12:04 ayushmahajan12