• How to use git strategies

    pai sho

    Imagine you have a feature branch with the latest changes, which you need to rebase by master. The problem is master have some changes too, but not the ones you do really care about. Of course, it is possible to run the following code and one by one resolve all annoying issues.

    git rebase master

    But there is a better way a lot of people keep forgetting about!

    git rebase -Xours master
    git rebase -Xtheirs master

    It will choose one branch changes over another’s. However, theirs and ours can be tricky. It’s all our code, right? So which of the branches is referred to as theirs then? Aren’t they both ours?

    Ours means the branch with canonical history (it’s master in our example above). Theirs means the branch with changes (so it’s the current branch when rebasing).

    Important to remember that everything changes to the opposite for the merge operation.