When merging topic branch \"B\" into \"A\" using git merge
, I get some conflicts. I know all the conflicts can be solved using the version in \"B\".
I a
See Junio Hamano's widely cited answer: if you're going to discard committed content, just discard the commits, or at any rate keep it out of the main history. Why bother everyone in the future reading commit messages from commits that have nothing to offer?
But sometimes there are administrative requirements, or perhaps some other reason. For those situations where you really have to record commits that contribute nothing, you want:
(edit: wow, did I manage to get this wrong before. This one works.)
git update-ref HEAD $(
git commit-tree -m 'completely superseding with branchB content' \
-p HEAD -p branchB branchB:
)
git reset --hard