Re: BUG? git stash and immediate git apply results in conflict

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 1, 2022 at 2:11 PM Akos Vandra-Meyer <axos88@xxxxxxxxx> wrote:
>  git stash -ku
>  git stash pop

This is not a bug in `git stash` itself, but rather in the way you're using it.

There are two mistakes on your part here:

1: You are using `-k`, aka `--keep-index`. This flag is intended for usages
that are not yours here.

2. You are *not* using `--index` in your `git pop`.  The `--index` flag is
intended for the kind of thing you are doing here.

It's a bit unfortunate (and perhaps worth some work in the documentation)
that the `--keep-index` and `--index` flags sound so similar, and yet are so
different.  The documentation could use some examples here, I think.

Note that if you *do* want to use `--keep-index` during the `git stash` step,
you will need a `git reset --hard` before your `git stash apply --index &&
git stash drop` step (aka `git stash pop --index`).

Chris



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux