FUD
FUD

Reputation: 5184

Git merge after a merge

Consider a scenario where while merging a branch lets say feature into master (git megre origin/feature) and after resolving conflicts, if someone pushes into the master branch again during this process. Now, we cannot push the merge into master as they have diverted again. I see these options in these scenarios.

Is there anything obvious I am missing which is cleaner and does not requires to redo the merge conflict work we just did?

Upvotes: 1

Views: 808

Answers (1)

ErikMD
ErikMD

Reputation: 14723

I think that you may want to try the following command:

git pull --rebase=preserve

or following if the upstream is already fetched

git rebase -p origin/master

where the semantics of option --rebase (according to the doc) is as follows:

When set to preserve, rebase with the --preserve-merges option passed to git rebase so that locally created merge commits will not be flattened.

However note that according to the doc of git rebase,

Merge conflict resolutions or manual amendments to merge commits are not preserved.

In order to avoid resolving conflicts again you can look into the usage of git rerere.

Upvotes: 2

Related Questions