On Tue, 18 Nov 2014 05:26:08 -0800 (PST)
Dmitry Moscow <koktebelnig...@gmail.com> wrote:

> I have some special task which is definitely out of everyday git
> practices scope. Please let me know if its possible to accomplish
> this with some hacks.
> I have two branches of development of a single product. These two
> branches diverged long ago. Now its time to merge them. The idea is
> to merge them without losing functionality. This means I dont want
> merge them simply by selecting most up-to-date version, I want BOTH
> versions to be present in case there are some difference between the
> files. 
> I.e. if some file differs in two branches - I want to raise a
> conflict to merge it manually. Note, that if file to merge has
> different versions in braches to merge - this does not necessarily
> forces Git will to raise a conflict. It will do it ONLY if there were
> conflicting changes after the branch separation point. This may not
> be my case all the time. For example, in this situation Git will do
> merge without a conflict, and I will just lose the branch A
> functionality in the lines 34 and 67. But I want to preserve ALL
> functionality from both branches:

You could try going one level deeper and use `git read-tree` instead:

  git read-tree -m HEAD <branch_to_merge>

This command should only update the index and do not touch the work
tree.  So any files with conflicts will be marked in the index as such
(with their "sides" available).

Note that this command creates a situation of the work tree being not
consistend with the index.  I mean, if the merge operation added some
files, they'll be missing from the work tree, and if it deleted some
files (which our side did not touch, so it's fine to delete them),
they'll be present in the work tree and deemed to be "untracked" by
`git status`.
Hence after fixing the conflicts you'll want to use
`git checkout-index` to update the work tree to the actual post-merge

You received this message because you are subscribed to the Google Groups "Git 
for human beings" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to git-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to