Re: [PATCH] Show an example of deleting commits with git-rebase.
Michael S. Tsirkin wrote:
> Shawn O. Pearce <spearce@spearce.org> wrote:
Show 30 quoted lines
>> Subject: [PATCH] Show an example of deleting commits with git-rebase.
>>
>> +A range of commits could also be removed with rebase. If we have
>> +the following situation:
>> +
>> +------------
>> + E---F---G---H---I---J topicA
>> +------------
>> +
>> +then the command
>> +
>> + git-rebase --onto topicA~5 topicA~2 topicA
>> +
>> +would result in the removal of commits F and G:
>> +
>> +------------
>> + E---H'---I'---J' topicA
>> +------------
>> +
>> +This is useful if F and G were flawed in some way, or should not be
>> +part of topicA. Note that the argument to --onto and the <upstream>
>> +parameter can be any valid commit-ish.
>> +
>
> Good clarification, a couple of comments:
> - The use of <branch> is more confusing than useful in this case.
> You can always just do
> git reset --hard topicA
> git rebase --onto topicA~5 topicA~2
> instead, correct?
I disagree. In my opinion using of <branch> makes it more clear: which
branch we are rebasing, and range of commits moved.
> - The use of ~ notation here is also more scary than clarifying.
> git rebase --onto F H
> will be clearer I think.
--
Jakub Narebski
Warsaw, Poland
ShadeHawk on #git