Question about git (merge branch vs cherry pick)

0
Hi all,    We have moved to Git from SVN but are unsure how some of the merging works. For context we run a maintenance line, for bug fixes. Then have new features on separate branch lines.   When we were on SVN we could select multiple commits from a branch and merge only those.  When you select "merge feature branch" does it merge every commit on that branch. Or does it only target those that have not already been merged?   Looking at the documention https://docs.mendix.com/refguide10/merge-dialog/ It says This merge scenario allows you to merge a complete feature branch line to the main line. Which suggests it does merge everything and thus we could end up with an issue in the scenario that:   - A change is made on a maintenance line - Several weeks later a change is made that also updates the same thing, but on a feature branch line - The maintenance line is merged again following some updates, it merges across the original change, reversing what was done on the feature branch   We do update our maintenance line from the mainline after every deployment of the mainline so this may negate this but thought I would ask.    We are also in the process of updating our dev practises so any best practices you can share would be useful.    Thank you
asked
3 answers
0

Hi Garion,

 

What I noticed from expirience is that when you do "merge feature branch" it will only merge the not already merged commit.

When you are working on Mx 9.24.x using the "port fix" option might have some issues.

For me it is sometimes merging the change but the studio pro doesn't show it and I can neither commit or merge a change.

 

I hope this helps you

Kind regards

Andre

answered
0

You are doing exactly the correct move: "We do update our maintenance line from the mainline after every deployment of the mainline". The "continuous integration" part. Branch 'maintenance' will be update now with the changes you made in the mainline when you merged the feature branch into the mainline. Hence, when eventually you will merge the branch maintenance into mainline, it will leave the feature branch's changes intact, and include the changes of branch maintenance.

answered
0

I think what you're looking for is something called Port fix

 

This scenario allows you to move a fix from a maintenance branch line to the main line. If you just want to redo a small fix, a single commit is often enough.

 

In SVN, it is possible to port multiple commits at once.

 

In Git, port fix transports the actual commit from one branch and directly applies it, including author and commit text to another branch. This means you do not need to explicitly commit your change.

answered