Lets say for the sake of argument that we don't care much about history.
If I have a master branch that is being updated somewhat often and I have a shared topic branch that is rather long lived, will regularly merging master-> topic branch (and resolving conflicts as they arise) allow for a smooth merge of the topic branch -> master later on?
If the merge request is approved without conflict, the GitLab master will merge into the branch, and both the master and release branches will be in sync. The source code and sample project used for these examples can be found on the gitlab-made-easy project page on GitLab.
creating branches. creating pull requests. Avoid allowing pull requests to become stale. Make sure you're not changing the same lines of code before merging a prior change.
Merging Branches. Once you've completed work on your branch, it is time to merge it into the main branch. Merging takes your branch changes and implements them into the main branch. Depending on the commit history, Git performs merges two ways: fast-forward and three-way merge.
What you're saying sounds uncontroversial - if you regularly merge (backport) changes from the main branch into a side branch, then, when the time comes to merge your side branch back into the main, you won't have as much work to do.
Of course, right? Over time, your branches diverge. And how you write your code today depends on how you wrote it yesterday. The more your branches have diverged today, the more they will diverge tomorrow.
Say that in the main branch you refactor some code. Say that in the side branch you have to implement a new feature that uses the code that was refactored. If you write that new feature before you merge (backport) the refactoring changes, then, when you want to port the new feature to the main branch, you will either have to a) add back into main the pre-refactored code or b) refactor the new feature. Whereas if you had already merged (backported) the refactoring, your new feature can be merged into main without all that work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With