Removing a commit from a local branch
- From
Chris Packham <judge.packham@gmail.com>
- Date
- Jan 11, 2009, 22:42 UTC
- Message-ID
- <a038bef50901111442y16695664y4fed7cdd9d8af27@mail.gmail.com>
- In-Reply-To
- <a038bef50901111441w21959397tc41922656a25027c@mail.gmail.com>
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