# Re: [BUG]: Destructive behaviour of git revert

2 messages from 2019-07-30 to 2019-07-30. Participants: Andreas Wiesinger, Phillip Wood.
Thread: https://gitlist.dev/t/51557

## Andreas Wiesinger, 2019-07-30 17:24

Subject: Re: [BUG]: Destructive behaviour of git revert
Message-ID: <CAP82knOVE5RbcDbD-SqbkoZ_4qubi96n2p3M_vgc4xGFVwTpMw@mail.gmail.com>
URL: https://gitlist.dev/e/CAP82knOVE5RbcDbD-SqbkoZ_4qubi96n2p3M_vgc4xGFVwTpMw%40mail.gmail.com
In-Reply-To: <CAP82knNJ7YH30R-Z61ake58qERp--6hdvgGasKpHQ2TbMPraiA@mail.gmail.com>

```
Hello,

git revert for merges will mark merged files as deleted and commit
them as if they would have been deleted, but that is for sure never
what anybody would expect and has deleted many files unintentionally
and unrecognized in our repo shortly.

I have reproduced this issue in a very small example repo here:
https://gitlab.com/electrocnic/git-revert-destructive-behaviour/tree/master

Expected behaviour would be:

A reverted merge should never mark any files or directories as
"deleted", and merging the branch where the other merge has been
reverted should not lead to the deletion of those files.

I classify this behaviour as really really destructive and clearly a
bug, even if this behaviour is by intention. It should not be by
intention then..

Best regards,
Andreas

```

## Phillip Wood, 2019-07-30 18:36

Subject: Re: [BUG]: Destructive behaviour of git revert
Message-ID: <015916f3-9386-d541-0603-b361c44a7ae8@gmail.com>
URL: https://gitlist.dev/e/015916f3-9386-d541-0603-b361c44a7ae8%40gmail.com
In-Reply-To: <CAP82knOVE5RbcDbD-SqbkoZ_4qubi96n2p3M_vgc4xGFVwTpMw@mail.gmail.com>

```
Hi Andreas

On 30/07/2019 18:24, Andreas Wiesinger wrote:
> Hello,
> 
> git revert for merges will mark merged files as deleted and commit
> them as if they would have been deleted, but that is for sure never
> what anybody would expect and has deleted many files unintentionally
> and unrecognized in our repo shortly.
> 
> I have reproduced this issue in a very small example repo here:
> https://gitlab.com/electrocnic/git-revert-destructive-behaviour/tree/master
> 
> Expected behaviour would be:
> 
> A reverted merge should never mark any files or directories as
> "deleted", and merging the branch where the other merge has been
> reverted should not lead to the deletion of those files.

Thanks for creating an example. I've had a quick look at it and it 
appears that you have a merge that adds a new file from the branch being 
merged, then when you revert the merge that file is deleted. Could you 
explain what you want to happen when you revert that merge? The idea of 
revert is to undo the changes introduced by the commit that is being 
reverted, I'm struggling to understand why you think revert should not 
do this for files that are added.

Best Wishes

Phillip

> I classify this behaviour as really really destructive and clearly a
> bug, even if this behaviour is by intention. It should not be by
> intention then..
> 
> Best regards,
> Andreas
> 

```
