git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Removing a commit from a local branch
       [not found] <a038bef50901111441w21959397tc41922656a25027c@mail.gmail.com>
@ 2009-01-11 22:42 ` Chris Packham
  2009-01-11 22:48   ` Jakub Narebski
                     ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Chris Packham @ 2009-01-11 22:42 UTC (permalink / raw)
  To: git

Hi List,

I'm part of a development team using git. We use a maintainer model
where developers send patches/pull requests to a maintainer who
applies the patches to a local branch, decides if they're good or not
and pushes the good patches to the public repository.

What I want to do is script the removal of a bad patch so that the
maintainer identifies a patch in his local branch, sends an email to
the author telling them why their patch is being rejected then removes
the commit for that patch. Using git log a script can extract the
author email address, hash and headline of each commit. Based on that
information scripting the email is easy enough. Now I come to using
git rebase to remove the bad commit based on its hash which leads me
to my question - How do I refer to a commit based on the hash of its
parent?

Consider the following example. The maintainer has the following branch locally

  todeliver: A-B-C-D

He is happy with commits A, C and D but wants to reject B. Ideally I
want to be able to say
  git rebase --onto <parent of B> <child of B> todelvier

and get
  todeliver: A-C'-D'

I know that <parent of B> can be referred to as B~1 but what about
<child of B>? I've read through the man page for git-rev-parse and
nothing stands out as child of commit X.

Is there a better what do achieve what I'm after?

Thanks,
Chris

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Removing a commit from a local branch
  2009-01-11 22:42 ` Removing a commit from a local branch Chris Packham
@ 2009-01-11 22:48   ` Jakub Narebski
  2009-01-11 22:52   ` Björn Steinbrink
  2009-01-12  1:20   ` Sitaram Chamarty
  2 siblings, 0 replies; 5+ messages in thread
From: Jakub Narebski @ 2009-01-11 22:48 UTC (permalink / raw)
  To: Chris Packham; +Cc: git, Stephan Beyer

"Chris Packham" <judge.packham@gmail.com> writes:

> Consider the following example. The maintainer has the following
> branch locally
> 
>   todeliver: A-B-C-D
> 
> He is happy with commits A, C and D but wants to reject B. Ideally I
> want to be able to say
>   git rebase --onto <parent of B> <child of B> todelvier
> 
> and get
>   todeliver: A-C'-D'
> 
> I know that <parent of B> can be referred to as B~1 but what about
> <child of B>? I've read through the man page for git-rev-parse and
> nothing stands out as child of commit X.
> 
> Is there a better what do achieve what I'm after?

Yes, I think it would be easier to either use "git rebase --interactive"
(with some script taking place of EDITOR, or something), or prod Stephan
Beyer (CC-ed) to finish git-sequencer...

-- 
Jakub Narebski
Poland
ShadeHawk on #git

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Removing a commit from a local branch
  2009-01-11 22:42 ` Removing a commit from a local branch Chris Packham
  2009-01-11 22:48   ` Jakub Narebski
@ 2009-01-11 22:52   ` Björn Steinbrink
  2009-01-12  0:12     ` Chris Packham
  2009-01-12  1:20   ` Sitaram Chamarty
  2 siblings, 1 reply; 5+ messages in thread
From: Björn Steinbrink @ 2009-01-11 22:52 UTC (permalink / raw)
  To: Chris Packham; +Cc: git

On 2009.01.12 11:42:24 +1300, Chris Packham wrote:
> Hi List,
> 
> I'm part of a development team using git. We use a maintainer model
> where developers send patches/pull requests to a maintainer who
> applies the patches to a local branch, decides if they're good or not
> and pushes the good patches to the public repository.
> 
> What I want to do is script the removal of a bad patch so that the
> maintainer identifies a patch in his local branch, sends an email to
> the author telling them why their patch is being rejected then removes
> the commit for that patch. Using git log a script can extract the
> author email address, hash and headline of each commit. Based on that
> information scripting the email is easy enough. Now I come to using
> git rebase to remove the bad commit based on its hash which leads me
> to my question - How do I refer to a commit based on the hash of its
> parent?
> 
> Consider the following example. The maintainer has the following branch locally
> 
>   todeliver: A-B-C-D
> 
> He is happy with commits A, C and D but wants to reject B. Ideally I
> want to be able to say
>   git rebase --onto <parent of B> <child of B> todelvier

You don't want <child of B> there, just B.

git rebase --onto <onto> <upstream> <branch>

Rebases the commits from the range <upstream>..<branch>, and that
_excludes_ the commit (referenced by) <upstream>.

So:
git rebase --onto B^ B todeliver

Works on: B..todeliver == todeliver --not B
And that range contains commits C and D.

Björn

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Removing a commit from a local branch
  2009-01-11 22:52   ` Björn Steinbrink
@ 2009-01-12  0:12     ` Chris Packham
  0 siblings, 0 replies; 5+ messages in thread
From: Chris Packham @ 2009-01-12  0:12 UTC (permalink / raw)
  To: Björn Steinbrink; +Cc: git

Thanks thats exactly what I was after.

On Mon, Jan 12, 2009 at 11:52 AM, Björn Steinbrink <B.Steinbrink@gmx.de> wrote:
> On 2009.01.12 11:42:24 +1300, Chris Packham wrote:
>> Hi List,
>>
>> I'm part of a development team using git. We use a maintainer model
>> where developers send patches/pull requests to a maintainer who
>> applies the patches to a local branch, decides if they're good or not
>> and pushes the good patches to the public repository.
>>
>> What I want to do is script the removal of a bad patch so that the
>> maintainer identifies a patch in his local branch, sends an email to
>> the author telling them why their patch is being rejected then removes
>> the commit for that patch. Using git log a script can extract the
>> author email address, hash and headline of each commit. Based on that
>> information scripting the email is easy enough. Now I come to using
>> git rebase to remove the bad commit based on its hash which leads me
>> to my question - How do I refer to a commit based on the hash of its
>> parent?
>>
>> Consider the following example. The maintainer has the following branch locally
>>
>>   todeliver: A-B-C-D
>>
>> He is happy with commits A, C and D but wants to reject B. Ideally I
>> want to be able to say
>>   git rebase --onto <parent of B> <child of B> todelvier
>
> You don't want <child of B> there, just B.
>
> git rebase --onto <onto> <upstream> <branch>
>
> Rebases the commits from the range <upstream>..<branch>, and that
> _excludes_ the commit (referenced by) <upstream>.
>
> So:
> git rebase --onto B^ B todeliver
>
> Works on: B..todeliver == todeliver --not B
> And that range contains commits C and D.
>
> Björn
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Removing a commit from a local branch
  2009-01-11 22:42 ` Removing a commit from a local branch Chris Packham
  2009-01-11 22:48   ` Jakub Narebski
  2009-01-11 22:52   ` Björn Steinbrink
@ 2009-01-12  1:20   ` Sitaram Chamarty
  2 siblings, 0 replies; 5+ messages in thread
From: Sitaram Chamarty @ 2009-01-12  1:20 UTC (permalink / raw)
  To: git

On 2009-01-11, Chris Packham <judge.packham@gmail.com> wrote:
> Consider the following example. The maintainer has the
> following branch locally
>
>   todeliver: A-B-C-D
>
> He is happy with commits A, C and D but wants to reject B. Ideally I
> want to be able to say
>   git rebase --onto <parent of B> <child of B> todelvier
>
> and get
>   todeliver: A-C'-D'

you have an off-by-one error here.  You need B, not child of
B.  Problem solved :-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-01-12  1:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <a038bef50901111441w21959397tc41922656a25027c@mail.gmail.com>
2009-01-11 22:42 ` Removing a commit from a local branch Chris Packham
2009-01-11 22:48   ` Jakub Narebski
2009-01-11 22:52   ` Björn Steinbrink
2009-01-12  0:12     ` Chris Packham
2009-01-12  1:20   ` Sitaram Chamarty

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).