# confusion with some `git reset` commands

4 messages from 2014-12-16 to 2014-12-18. Participants: Arup Rakshit, Kevin, Christian Couder, Konstantin Khomoutov.
Thread: https://gitlist.dev/t/38186

## Arup Rakshit, 2014-12-16 18:39

Subject: confusion with some `git reset` commands
Message-ID: <2055441.uOK6yH3IMG@linux-wzza.site>
URL: https://gitlist.dev/e/2055441.uOK6yH3IMG%40linux-wzza.site

```
Hi,

>From the command help I see - 

[arup@to_do_app]$ git reset -h
usage: git reset [--mixed | --soft | --hard | --merge | --keep] [-q] 
[<commit>]
   or: git reset [-q] <tree-ish> [--] <paths>...
   or: git reset --patch [<tree-ish>] [--] [<paths>...]

    -q, --quiet           be quiet, only report errors
    --mixed               reset HEAD and index
    --soft                reset only HEAD
    --hard                reset HEAD, index and working tree
    --merge               reset HEAD, index and working tree
    --keep                reset HEAD but keep local changes
    -p, --patch           select hunks interactively

But I am looking for any differences -

a) git reset --soft and git reset --keep
b) git reset --hard and git reset --merge


-- 
================
Regards,
Arup Rakshit
================
Debugging is twice as hard as writing the code in the first place. Therefore, 
if you write the code as cleverly as possible, you are, by definition, not 
smart enough to debug it.

--Brian Kernighan

```

## Kevin, 2014-12-18 08:23

Subject: Re: confusion with some `git reset` commands
Message-ID: <CAO54GHAVMSYCHAoqH1OOSaUeHBdSmqTvzJLWWUa0_bO3CLy4zg@mail.gmail.com>
URL: https://gitlist.dev/e/CAO54GHAVMSYCHAoqH1OOSaUeHBdSmqTvzJLWWUa0_bO3CLy4zg%40mail.gmail.com
In-Reply-To: <2055441.uOK6yH3IMG@linux-wzza.site>

```
On Tue, Dec 16, 2014 at 7:39 PM, Arup Rakshit
<aruprakshit@rocketmail.com> wrote:
> Hi,
> ..
>
> But I am looking for any differences -
>
> a) git reset --soft and git reset --keep

git reset --keep is a safer version of git reset --hard. It will reset
the working tree. but will abort when it has to overwrite uncomitted
changes.

> b) git reset --hard and git reset --merge

git reset --merge does the same as hard, but keeps unstaged changes.
When unstaged changes would need to be overwritted, it also aborts.

```

## Christian Couder, 2014-12-18 08:38

Subject: Re: confusion with some `git reset` commands
Message-ID: <CAP8UFD3iUjDsFfFfiPKKqmUkz6mfOHL7_mjam8P-_K11XYknxg@mail.gmail.com>
URL: https://gitlist.dev/e/CAP8UFD3iUjDsFfFfiPKKqmUkz6mfOHL7_mjam8P-_K11XYknxg%40mail.gmail.com
In-Reply-To: <CAO54GHAVMSYCHAoqH1OOSaUeHBdSmqTvzJLWWUa0_bO3CLy4zg@mail.gmail.com>

```
> On Tue, Dec 16, 2014 at 7:39 PM, Arup Rakshit
> <aruprakshit@rocketmail.com> wrote:

>> From the command help I see -
>>
>> [arup@to_do_app]$ git reset -h

You can also use "git help reset" to have the full man page.
It has a lot more information.

>> But I am looking for any differences -

Do you have some use cases in mind?

Best,
Christian.

```

## Konstantin Khomoutov, 2014-12-18 12:09

Subject: Re: confusion with some `git reset` commands
Message-ID: <20141218150933.01825f2d6c827aa6eab99507@domain007.com>
URL: https://gitlist.dev/e/20141218150933.01825f2d6c827aa6eab99507%40domain007.com
In-Reply-To: <2055441.uOK6yH3IMG@linux-wzza.site>

```
On Wed, 17 Dec 2014 01:09:08 +0630
Arup Rakshit <aruprakshit@rocketmail.com> wrote:

[...]
> But I am looking for any differences -
> 
> a) git reset --soft and git reset --keep
> b) git reset --hard and git reset --merge

Please consider reading
http://git-scm.com/book/en/v2/Git-Tools-Reset-Demystified

```
