Automated CI tool merges fixes from release
to master
. But some commits from release branch should be ignored.
Let's consider the following example:
Release branch contains two fixes: fix-1
should be ignored and fix-2
should be merged to master
.
base ----------- merge-fix-2 - master
\ /
fix-1 --- fix-2 --- release
With this configuration merge of fix-2
also includes fix-1
changes.
To avoid this I need empty merge-commit (ignore-fix-1
), just for notify Git that fix-1
has been already merged and these changes should be ignored in upcoming merges:
base -- ignore-fix-1 -- merge-fix-2 -- master
\ / /
fix-1 ----- fix-2 ---- release
The question is: how to do that ignore-fix-1
empty commit?
Thus, if you want to ensure your branch is not changed or updated by the merge command, use --no-ff with --no-commit.
You can pass -s ours
to git merge
to use the "ours" merge strategy, which does exactly what you want: performs a "merge" by completely ignoring the incoming branch.
That said, this is a surprising thing to do to your history, to say the least. I assume you have a compelling reason not to want a hotfix in master
, but if this sort of thing happens frequently, you might want to consider a different approach, e.g.:
release
into stable
(for fix-2
) and production
(for fix-1
), then frequently merge stable
into both master
and production
.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With