# Merging branches

3 messages from 2010-07-13 to 2010-07-14. Participants: jhapk, Ævar Arnfjörð Bjarmason, Avery Pennarun.
Thread: https://gitlist.dev/t/24386

## jhapk, 2010-07-13 21:28

Subject: Merging branches
Message-ID: <1279056529462-5289861.post@n2.nabble.com>
URL: https://gitlist.dev/e/1279056529462-5289861.post%40n2.nabble.com

```

http://git.661346.n2.nabble.com/file/n5289861/git.jpg git.jpg 

Hi,

I have a git history which looks something like as in the figure above. I
want to merge Branch A in Branch B. However, the commits a1, a2 and a3 are
ugly and so I don't want those commits in my Branch B log. Is there anyway
that I can only pull the final form of Branch A without pulling the whole
history of Branch A?

Thanks
-- 
View this message in context: http://git.661346.n2.nabble.com/Merging-branches-tp5289861p5289861.html
Sent from the git mailing list archive at Nabble.com.

```

## Ævar Arnfjörð Bjarmason, 2010-07-13 22:05

Subject: Re: Merging branches
Message-ID: <AANLkTikPdOVCs5aB7Gs5QCFGDIgBm00DO5XPkP39mzIW@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTikPdOVCs5aB7Gs5QCFGDIgBm00DO5XPkP39mzIW%40mail.gmail.com
In-Reply-To: <1279056529462-5289861.post@n2.nabble.com>

```
On Tue, Jul 13, 2010 at 21:28, jhapk <pradeep.kumar.jha@gmail.com> wrote:
> I have a git history which looks something like as in the figure above. I
> want to merge Branch A in Branch B. However, the commits a1, a2 and a3 are
> ugly and so I don't want those commits in my Branch B log. Is there anyway
> that I can only pull the final form of Branch A without pulling the whole
> history of Branch A?

Yes, you use rebase to squash or drop those commits, and then merge the branch.

```

## Avery Pennarun, 2010-07-14 05:24

Subject: Re: Merging branches
Message-ID: <AANLkTimFGQg1KEqpVBvifrLR8_BH_p6s6qswn614s58q@mail.gmail.com>
URL: https://gitlist.dev/e/AANLkTimFGQg1KEqpVBvifrLR8_BH_p6s6qswn614s58q%40mail.gmail.com
In-Reply-To: <AANLkTikPdOVCs5aB7Gs5QCFGDIgBm00DO5XPkP39mzIW@mail.gmail.com>

```
On Tue, Jul 13, 2010 at 6:05 PM, Ævar Arnfjörð Bjarmason
<avarab@gmail.com> wrote:
> On Tue, Jul 13, 2010 at 21:28, jhapk <pradeep.kumar.jha@gmail.com> wrote:
>> I have a git history which looks something like as in the figure above. I
>> want to merge Branch A in Branch B. However, the commits a1, a2 and a3 are
>> ugly and so I don't want those commits in my Branch B log. Is there anyway
>> that I can only pull the final form of Branch A without pulling the whole
>> history of Branch A?
>
> Yes, you use rebase to squash or drop those commits, and then merge the branch.

Or just "git merge --squash".

Have fun,

Avery

```
