If the two branches have points in their history that should naturally be stitched together (e.g : commits with the same content), you can use git replace
(I don't know if it already existed in 1.8, though ?) or grafts to stitch the histories together :
# say <commit-a> on branch 'other' should be treated as
# <commit-b> on branch 'mine' :
git replace <commit-a> <commit-b>
# if 'git replace' does not exist :
# find the *descendant* of commit-a (say : child-a) and run :
echo "<child-a> <commit-b>" >> .git/info/grafts
# <child-a> is now treated as if <commit-b> was one of his parents
You should then be able to run git merge
.
Remove the replace
(git replace -d <commit-a>
) or the graft (remove line from .git/info/grafts
, or the whole file if you don't have any other grafts).
Another option is to dump the complete content of branch other
as a patch (for example : diff it against a fake commit which has an empty content), and use git apply
:
git diff <commit with empty content> other > other.patch
git apply other.patch