From: Jakub Narebski <jnareb@gmail.com>
To: "Peter Valdemar Mørch " <4ux6as402@sneakemail.com>
Cc: git@vger.kernel.org
Subject: Re: git merge after git cherry-pick?
Date: Wed, 23 Jul 2008 10:56:25 -0700 (PDT) [thread overview]
Message-ID: <m3y73sv60v.fsf@localhost.localdomain> (raw)
In-Reply-To: <48876709.3090504@sneakemail.com>
"Peter Valdemar Mørch (Lists)" <4ux6as402@sneakemail.com> writes:
> On a branch, b, made off of master, I've made the commits b1, b2, b3
> and b4.
>
> Back on master, I need commit b1 and b3 immediately. So I:
>
> $ git checkout master
> $ git cherry-pick "b1's SHA"
> $ git cherry-pick "b3's SHA"
>
> Now, both b and master contain b1 and b3. How do I now create a log of
> "what remains to be merged from b to master", i.e. only b2 and b4?
You can use "git cherry master b" command (or just "git cherry master"
if you are on branch 'b') to check which commits (based on patch id)
on branch 'b are already present on branch 'master'.
Alternatively you can use "git log --left-right master...b" to check
which comits are on which branch, although I think it wouldn't mark
duplicated commits.
> And how do I merge b2 and b4 to master, so master's log shows b1,
> b3, b2 and b4 and doesn't show b1 and b3 twice, which is what I get
> if I:
>
> $ git merge b
>
> after the cherry-picks above. Also I noticed, that if I merge master
> into b (to keep up-to-date with master) b1 and b3 are also mentioned
> twice.
You can instead of merging branch 'b' into master rebase it on top of
master.
This would create instead of the following history (for merge):
---*---b1'---b3'--------------M <-- master
\ /
\-b1----b2----b3----b4-/ <-- b
the following
---*---b1'---b3'---b1'---b4' <-- master, b
.
..b1....b2....b3....b4 <.. b@{1} (reflog)
[cut]
HTH
--
Jakub Narebski
Poland
ShadeHawk on #git
prev parent reply other threads:[~2008-07-23 17:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-07-23 17:14 git merge after git cherry-pick? "Peter Valdemar Mørch (Lists)"
2008-07-23 17:56 ` SZEDER Gábor
2008-07-23 19:35 ` "Peter Valdemar Mørch (Lists)"
2008-07-23 17:56 ` Jakub Narebski [this message]
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=m3y73sv60v.fsf@localhost.localdomain \
--to=jnareb@gmail.com \
--cc=4ux6as402@sneakemail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.