git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jonathan Nieder <jrnieder@gmail.com>
To: Craig de Stigter <craig.destigter@koordinates.com>
Cc: git@vger.kernel.org
Subject: Re: merging branches with separate but identical history
Date: Tue, 31 Aug 2010 16:16:02 -0500	[thread overview]
Message-ID: <20100831211602.GF5911@burratino> (raw)
In-Reply-To: <AANLkTikTzZe=c=RaEYSr_wjfHht4PZihggnV9vEOehvy@mail.gmail.com>

Hi,

Craig de Stigter wrote:

> I have two branches which start with the same commits, and I want to merge them.
> I believe the two branches were individually pulled from the same SVN
> repo
[...]
> If I do:
>> git checkout branch1
>> git merge branch2
> Merge made by recursive
> 
> The merge succeeds but the commits in each branch aren't squashed
> together (git log shows two commits for each actual commit)
>  i.e., now my history looks like this:
> 
> a--a--b--b--c--c--d--d--e--e--f--f--1--2--3--4--5--6
> 
> Is there a way to do this without the duplicates? (perhaps a way to
> mark the branch as merged up to 'f', without actually performing a
> merge?)

No.  I would suggest trying

 git cat-file commit a
 git cat-file commit A

where a and A are the two versions of "a" and comparing them.
How do they differ?

If you don't care about superseding the old history and just want
to combine the two branches into a single history, you can try something
like this:

 $ git checkout branch1
 $ git rebase -i branch1~3 --onto branch2~3
 $ git merge branch2

If the history after the fork point is not linear, you can still do
something very similar with grafts.  See git-filter-branch(1) for
details.

Hope that helps,
Jonathan

  reply	other threads:[~2010-08-31 21:17 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <AANLkTikoDkhKTRmob=B_NYJSYoby0J3Zo-Qp43AU9WfZ@mail.gmail.com>
2010-08-31 21:01 ` merging branches with separate but identical history Craig de Stigter
2010-08-31 21:16   ` Jonathan Nieder [this message]
2010-09-01 12:35   ` Henrik Grubbström

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100831211602.GF5911@burratino \
    --to=jrnieder@gmail.com \
    --cc=craig.destigter@koordinates.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).