This will be git rebase --onto combined with git merge-base :
git checkout stage/2.0 git rebase --onto stage/onto $(git merge-base development feature) feature
This will cause the feature branch to be feature again after G (which is the merge base commit between development and function) on stage/2.0 branch .
Result:
stage/2.0.0 A--B--C--D \ feature H'--I'--K' development E--F--G--J--L
The old H , I and K tags still refer to reflog ( git reflog ), but were selected by cherry and played over stage/2.0 .
Is this workflow right? Are we trying to do something that is not sustainable?
This, with the following reservations:
After such a reboot, it should include rigorous tests, because H , I and K , where it runs on top of G , which is generally absent in the stage/2.0 branch.
If these commits are dependent on G based content, this initial content will not be found in the intermediate branch. Some regression tests should make this obvious.
Using git cherry-pick (which can also play multiple commits), duplicate these commits to the intermediate branch, leaving the feature branch as it is (i.e. without reconnecting to the intermediate branch).
This seems strange, given that you will need to start which commits were selected by the cherry, and which other new feature commits have not yet been selected from the cherry for setting.
What happens if development is combined into a function between I and K ? (The developer caches his branch)
Will the cherry pick also include this union and all the code in the development branch along with it?
Yes, this will include a merge commit, but not the dev branch. In any case, this is not ideal. The best practice is not to merge dev with feature , but to swap feature on top of dev ( git rebase dev ).
Then, when the function is ready, rebase --onto stage/2.0
So what does the rebase --onto , basically move the function branch to stage/2.0.0 ?
Yes.
Is the feature branch disabled?
No: it is recreated by reapplying each commit fix on stage/2.0.0 .
The previous traits of the feature branches visible before rebase --onto are still present, but invisible, referenced only by git reflog , as mentioned above.
Nested $(git merge-base development feature) command $(git merge-base development feature) Does it use changes from function to development before moving branch to stage / 2.0.0 branch?
No: this is the calculation of the initial commit for this function branch, i.e.: development commit, from which the feature branch was started.
If I hadn’t used it, but a simple git rebase , the commit from the feature branch would include all the commits available from feature HEAD (and that would also include development )