# Revert option for git add --patch

3 messages from 2012-11-07 to 2012-11-08. Participants: Nathan Broadbent, Simon Rozet, Michal Kiedrowicz.
Thread: https://gitlist.dev/t/32037

## Nathan Broadbent, 2012-11-07 23:54

Subject: Revert option for git add --patch
Message-ID: <CAPXHQbN0x-o_4rQO-Lq_gDTqs=beBE5XrrzJ1Th+7G2Lq7Dh_Q@mail.gmail.com>
URL: https://gitlist.dev/e/CAPXHQbN0x-o_4rQO-Lq_gDTqs%3DbeBE5XrrzJ1Th%2B7G2Lq7Dh_Q%40mail.gmail.com
In-Reply-To: <CAPXHQbOxNG0XN80rH6mM6iSVtCtU26Yio_XQ=5ofBHBpZN3VyQ@mail.gmail.com>

```
Hi,

I would like to propose a revert option for 'git add --patch', that
reverts the hunk. I often use `git add -p` to skip whitespace changes
when preparing a patch, and a 'revert' option would save me from
running 'git checkout <file>' after I've staged the desired changes.

I would propose adding r and R options for the 'Stage this hunk' menu,
with the following actions:

r: Revert this hunk
R: Revert this hunk and all other remaining hunks

e.g. Stage this hunk [y/n/a/d/K/j/J/e/r/R?]?


Please let me know if you think this is a good idea.


Best,
Nathan

```

## Simon Rozet, 2012-11-08 01:00

Subject: Re: Revert option for git add --patch
Message-ID: <CAHAYOozgUaV=GH8zOaJn1xLSM_M-aKmFovcOEVzYpNTBW6ifgQ@mail.gmail.com>
URL: https://gitlist.dev/e/CAHAYOozgUaV%3DGH8zOaJn1xLSM_M-aKmFovcOEVzYpNTBW6ifgQ%40mail.gmail.com
In-Reply-To: <CAPXHQbN0x-o_4rQO-Lq_gDTqs=beBE5XrrzJ1Th+7G2Lq7Dh_Q@mail.gmail.com>

```
help

On Wed, Nov 7, 2012 at 3:54 PM, Nathan Broadbent <nathan.f77@gmail.com> wrote:
> Hi,
>
> I would like to propose a revert option for 'git add --patch', that
> reverts the hunk. I often use `git add -p` to skip whitespace changes
> when preparing a patch, and a 'revert' option would save me from
> running 'git checkout <file>' after I've staged the desired changes.
>
> I would propose adding r and R options for the 'Stage this hunk' menu,
> with the following actions:
>
> r: Revert this hunk
> R: Revert this hunk and all other remaining hunks
>
> e.g. Stage this hunk [y/n/a/d/K/j/J/e/r/R?]?
>
>
> Please let me know if you think this is a good idea.
>
>
> Best,
> Nathan
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

```

## Michal Kiedrowicz, 2012-11-08 08:46

Subject: Re: Revert option for git add --patch
Message-ID: <loom.20121108T094500-131@post.gmane.org>
URL: https://gitlist.dev/e/loom.20121108T094500-131%40post.gmane.org
In-Reply-To: <CAPXHQbN0x-o_4rQO-Lq_gDTqs=beBE5XrrzJ1Th+7G2Lq7Dh_Q@mail.gmail.com>

```
Nathan Broadbent <nathan.f77 <at> gmail.com> writes:

> I would like to propose a revert option for 'git add --patch', that
> reverts the hunk. I often use `git add -p` to skip whitespace changes
> when preparing a patch, and a 'revert' option would save me from
> running 'git checkout <file>' after I've staged the desired changes.


Doesn't `git checkout -p` do what you describe?

Kind regards,
Michal Kiedrowicz

```
