> From: Dmitry Moscow <koktebelnig...@gmail.com>

> I got to branch A which I want to 'merge' (preserving the differencies) 
> with branch B. 
> I run git read-tree -m HEAD <branch B>
> I get a number of files updated and added in my working folder. Files that 
> were absent in branch A are added, the differenceis are applied. But 
> unfortunately the differencies between the files are still erasing the old 
> lines. I mean if there were difference in branch A and branch B on the same 
> line in some file - after this command lines of that file in branch A where 
> I run the command are replaced with lines from branch B. And there is no 
> conflict. So it loooks like typical merge.

It seems to me that it would work to construct two working
directories, one for each branch.  Run "diff -r --brief A B" between
working directories, which will tell you all of the differences.  Copy
or merge what you desire from B into A, so that A is the merged file
tree that you desire.  Do "git add" in A to update the index to match
the working directory.  Do "git write-tree" to create a tree object in
the repository from the index.  Then do "git commit-tree [hash of
tree] [head commit of A] [head commit of B]" to create a new commit
containing the merged code and with the heads of A and B as parents.
Then use "git branch -f [branch] [new commit hash]" to set the head of
whatever branch you want to be the new commit.


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