# rebasing branch with reverted patches

7 messages from 2011-04-19 to 2011-04-19. Participants: Francis Moreau, Michael J Gruber, Andreas Ericsson, Santi Béjar.
Thread: https://gitlist.dev/t/27130

## Francis Moreau, 2011-04-19 07:32

Subject: rebasing branch with reverted patches
Message-ID: <BANLkTim5mf6okFN8V5V+B=Ns1JORD47a5A@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTim5mf6okFN8V5V%2BB%3DNs1JORD47a5A%40mail.gmail.com

```
Hello,

I'm wondering if it would be a good idea for git rebase to allow not
rebasing reverted patch which are part of the rebased branch.

For example I'm currently rebasing my branch 'devel' onto master. This
branch have several commits and specially one called A and another one
called A' which reverts A.

When rebasing 'devel' branch, rebase could try to drop both A and A'.

What do you think ?

BTW is there a way to do this currently ?

Thanks
-- 
Francis

```

## Michael J Gruber, 2011-04-19 08:42

Subject: Re: rebasing branch with reverted patches
Message-ID: <4DAD4B0F.9030908@drmicha.warpmail.net>
URL: https://gitlist.dev/e/4DAD4B0F.9030908%40drmicha.warpmail.net
In-Reply-To: <BANLkTim5mf6okFN8V5V+B=Ns1JORD47a5A@mail.gmail.com>

```
Francis Moreau venit, vidit, dixit 19.04.2011 09:32:
> Hello,
> 
> I'm wondering if it would be a good idea for git rebase to allow not
> rebasing reverted patch which are part of the rebased branch.
> 
> For example I'm currently rebasing my branch 'devel' onto master. This
> branch have several commits and specially one called A and another one
> called A' which reverts A.
> 
> When rebasing 'devel' branch, rebase could try to drop both A and A'.
> 
> What do you think ?
> 
> BTW is there a way to do this currently ?

You can do this with "rebase -i" by removing A and A' from the commit
list (or squashing them or dealing with them in whatever way you like).

Michael

```

## Francis Moreau, 2011-04-19 09:09

Subject: Re: rebasing branch with reverted patches
Message-ID: <BANLkTimbSes-B8zK2a2t1Jp1v+29HdNvqw@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTimbSes-B8zK2a2t1Jp1v%2B29HdNvqw%40mail.gmail.com
In-Reply-To: <4DAD4B0F.9030908@drmicha.warpmail.net>

```
On Tue, Apr 19, 2011 at 10:42 AM, Michael J Gruber
<git@drmicha.warpmail.net> wrote:
> Francis Moreau venit, vidit, dixit 19.04.2011 09:32:
>> Hello,
>>
>> I'm wondering if it would be a good idea for git rebase to allow not
>> rebasing reverted patch which are part of the rebased branch.
>>
>> For example I'm currently rebasing my branch 'devel' onto master. This
>> branch have several commits and specially one called A and another one
>> called A' which reverts A.
>>
>> When rebasing 'devel' branch, rebase could try to drop both A and A'.
>>
>> What do you think ?
>>
>> BTW is there a way to do this currently ?
>
> You can do this with "rebase -i" by removing A and A' from the commit
> list (or squashing them or dealing with them in whatever way you like).

Of course, but my point was to make this automatically...

-- 
Francis

```

## Andreas Ericsson, 2011-04-19 09:15

Subject: Re: rebasing branch with reverted patches
Message-ID: <4DAD52BA.5000206@op5.se>
URL: https://gitlist.dev/e/4DAD52BA.5000206%40op5.se
In-Reply-To: <BANLkTimbSes-B8zK2a2t1Jp1v+29HdNvqw@mail.gmail.com>

```
On 04/19/2011 11:09 AM, Francis Moreau wrote:
> On Tue, Apr 19, 2011 at 10:42 AM, Michael J Gruber
> <git@drmicha.warpmail.net>  wrote:
>> Francis Moreau venit, vidit, dixit 19.04.2011 09:32:
>>> Hello,
>>>
>>> I'm wondering if it would be a good idea for git rebase to allow not
>>> rebasing reverted patch which are part of the rebased branch.
>>>
>>> For example I'm currently rebasing my branch 'devel' onto master. This
>>> branch have several commits and specially one called A and another one
>>> called A' which reverts A.
>>>
>>> When rebasing 'devel' branch, rebase could try to drop both A and A'.
>>>
>>> What do you think ?
>>>
>>> BTW is there a way to do this currently ?
>>
>> You can do this with "rebase -i" by removing A and A' from the commit
>> list (or squashing them or dealing with them in whatever way you like).
> 
> Of course, but my point was to make this automatically...
> 

That would be akin to removing in-code comments of why it's a bad idea
to implement a particular solution in a particular way, and it also
removes the capability of reverting the revert (ie, re-doing the change)
at a later time when stability can be sacrificed temporarily.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

```

## Francis Moreau, 2011-04-19 09:19

Subject: Re: rebasing branch with reverted patches
Message-ID: <BANLkTi=2LZGdZ7+QfVbd3g9dTKEcjNwsHw@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTi%3D2LZGdZ7%2BQfVbd3g9dTKEcjNwsHw%40mail.gmail.com
In-Reply-To: <4DAD52BA.5000206@op5.se>

```
On Tue, Apr 19, 2011 at 11:15 AM, Andreas Ericsson <ae@op5.se> wrote:
>
> That would be akin to removing in-code comments of why it's a bad idea
> to implement a particular solution in a particular way, and it also
> removes the capability of reverting the revert (ie, re-doing the change)
> at a later time when stability can be sacrificed temporarily.

That's right but OTOH I use git-rebase for development stuff where all
correct points you raised don't apply.

-- 
Francis

```

## Santi Béjar, 2011-04-19 09:39

Subject: Re: rebasing branch with reverted patches
Message-ID: <BANLkTim_QNFhChme=nxGf1_Dw8LedTS3Ag@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTim_QNFhChme%3DnxGf1_Dw8LedTS3Ag%40mail.gmail.com
In-Reply-To: <BANLkTimbSes-B8zK2a2t1Jp1v+29HdNvqw@mail.gmail.com>

```
On Tue, Apr 19, 2011 at 11:09 AM, Francis Moreau <francis.moro@gmail.com> wrote:
> On Tue, Apr 19, 2011 at 10:42 AM, Michael J Gruber
> <git@drmicha.warpmail.net> wrote:
>> Francis Moreau venit, vidit, dixit 19.04.2011 09:32:
>>> Hello,
>>>
>>> I'm wondering if it would be a good idea for git rebase to allow not
>>> rebasing reverted patch which are part of the rebased branch.
>>>
>>> For example I'm currently rebasing my branch 'devel' onto master. This
>>> branch have several commits and specially one called A and another one
>>> called A' which reverts A.
>>>
>>> When rebasing 'devel' branch, rebase could try to drop both A and A'.
>>>
>>> What do you think ?
>>>
>>> BTW is there a way to do this currently ?
>>
>> You can do this with "rebase -i" by removing A and A' from the commit
>> list (or squashing them or dealing with them in whatever way you like).
>
> Of course, but my point was to make this automatically...

You can also change the A' commit title to "fixup! original_title"
while reverting (there is no --fixup argument like "git commit" has),
then git rebase -i would reorder the todo file for you.

git revert gets confused by the resulting empty change but you can
"git rebase --continue", or now that both are next to the other just
remove them.

HTH,
Santi

```

## Francis Moreau, 2011-04-19 10:21

Subject: Re: rebasing branch with reverted patches
Message-ID: <BANLkTim9vKpp6=AwSG9pkWZrw9YKCuFS9w@mail.gmail.com>
URL: https://gitlist.dev/e/BANLkTim9vKpp6%3DAwSG9pkWZrw9YKCuFS9w%40mail.gmail.com
In-Reply-To: <BANLkTim_QNFhChme=nxGf1_Dw8LedTS3Ag@mail.gmail.com>

```
Hello,

On Tue, Apr 19, 2011 at 11:39 AM, Santi Béjar <santi@agolina.net> wrote:
>
> You can also change the A' commit title to "fixup! original_title"
> while reverting (there is no --fixup argument like "git commit" has),
> then git rebase -i would reorder the todo file for you.

Interesting I wasn't aware of --autosquash option, thanks.

This is almost what I was asking for actually, the only part which is
missing is the fact that git-rebase detect the "Revert: " magic
string, check that the revert is sane (by comparing the diff of the
revert with the diff of the original commit) and do the same as
"fixup!" would do without the confusion of the resulting empty commit.

Thanks
-- 
Francis

```
