Skip to content

Help with --ours merge strategy trick needed #426

@hedrok

Description

@hedrok

Could someone please explain the last paragraph of book/07-git-tools/sections/advanced-merging.asc?..
I've tried a lot of variants, but however I merge the 'bugfix' branch to both 'master' and 'develop' branches, I get no conflict when I merge 'release' back to 'master'...
What should I do to get this conflict?..

This [--ours merge strategy] can often be useful to basically trick Git into thinking that a branch is already merged when doing a merge later on. For example, say you branched off a release branch and have done some work on it that you will want to merge back into your master branch at some point. In the meantime some bugfix on master needs to be backported into your release branch. You can merge the bugfix branch into the release branch and also merge -s ours the same branch into your master branch (even though the fix is already there) so when you later merge the release branch again, there are no conflicts from the bugfix.

I'm currently translating the book to Ukrainian and would like to fully understand everything I translate.

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions