What is the right git workflow with shared feature branches?

git

Solution

Considering `feature` branch is already shared, it shouldn't be rebased on `master` (as it changes its - shared - history).

A simple merge from `master` to `feature` will be enough (without speculating as why `dev3` pushed to `master` in the first place).

As Adam Dymitruk comments, this is called a "back-merge", and, depending on the role you attribute to `master`, it is questionable: if `master` represents the stable production state, you should merge to `master`, not from `master`.

But again, my answer made no assumption on said role.

This is why the famous git-flow illustrates in its blog post merges which are coming to master (from, for instance, an `hotfix` branch, as I commented earlier)

Problem

Say I have a branch named `feature` that has been branched off `master`. Both, developer1 and developer2 checkout `feature`. developer1 commits a change to `feature` and pushes it. Then developer3 pushes something to `master`. At this point `master` and `feature` diverge, each having a separate commit. What's the right way to go about getting the latest from `master` into the `feature`, if there are conflicts? Should I rebase `master` into the `feature`, or merge it in? EDIT: I should mention that in this case I would not want to rewrite the history on developer2. Because that would be bad. Right?

Original source

Related problems