Hello folks,
What are your thoughts on merging vs rebasing? If I am the only person working on a feature branch, is it okay if I rebase my branch onto main/demo or do you recommend that I merge my feature branch into main/demo instead?
I have read this article here - https://www.atlassian.com/git/tutorials/merging-vs-rebasing
Per the article, the golden rule of git rebase is to never use it on public branches. What does a public branch mean? For e.g. - Is the master/demo branch (restricted to a particular team) which is being worked on multiple people considered a public branch
Hello Varun,
yes - follow the golden rule, i.e. don't rebase a (public) branch that is visible to others onto _your_ (private) branch.
And, as you are mentioning merge conflicts, even if you follow the golden rule of re-basing, you will still need to resolve conflicts, in case the same files and lines have changed in public and feature branch and git cannot resolve the changes. In fact, previously resolved merge conflicts may appear again if you perform another rebase later.
We use git-merge to resolve merge conflicts, i.e. merge the main into a feature branch, resolve conflicts and commit the feature branch.
We have published 2 articles in this community that elaborate on git merge and rebase in detail (see links below).
Cheers, Ulrich
// Izymes
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.