Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support maintaining multiple versions/branches on main #9362

Merged
merged 20 commits into from
Dec 18, 2024

Conversation

davidfirst
Copy link
Member

@davidfirst davidfirst commented Dec 9, 2024

In some scenarios, it's needed to maintain some legacy code, for example, the new code is 2.x and the legacy is 1.x which still needs to be maintained.
If a patch is needed to 1.x code, the component needs to be checked out to 1.x and tagged with a specific version, for example: bit tag --ver 1.0.1 --ignore-newest-version.
Currently, when this patch is done, although the history of this patch is correct thanks to a recent PR, but the head now points to this patch version. As a result, when importing the component, the user gets 1.0.1 and not 2.x.
This PR introduces a new flag --detach-head to keep the head intact in this case, so the head still points to 2.x, while the .bitmap is updated to 1.0.1. This new patch 1.0.1 becomes a detached head.

It also supports lanes. It's possible to work on multiple components when they're checked out to 1.x, create a new lane, snap some changes, then merge the lane with --detach-head flag. This flag, instruct bit to find the common snap before the divergent point, and merge the lane to that point and not to the head.

In order for the garbage collector to not delete this detached-head snap, and for the remote to not identify this component as a merge-conflict, we save a new prop detachedHeads into ModelComponent object.

For now, this flag --detach-head is under a feature-flag. It'll be enabled by default once bit cloud is deployed with a new version that supports it.

@davidfirst davidfirst merged commit 5a5924f into master Dec 18, 2024
10 checks passed
@davidfirst davidfirst deleted the maintaining-multiple-branches branch December 18, 2024 02:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants