Re: [PATCH v2] git-stash.txt: Add example "Using stash selectively"

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

 



Am 5/6/2010 10:40, schrieb Jari Aalto:
> +$ git reset                     # make the index clean
> +$ git add -p A C                # add necessary bits to the index
> +$ git stash save --keep-index   # the remainder goes to the stash

Isn't "the remainder goes to the stash" wrong? I thought that both
worktree changes and index go to stash; only that changes recorded in the
index are not undone in the index and worktree.

> +... test, debug, perfect ...
> +$ git commit
> +$ git stash pop                 # get the remainder back

And here both changes are unstashed, but since the changes that previously
were only in the index are already commited, it looks as if no index
changes were unstashed.

The distinction is important because if you 'stash --keep-index', but then
change your mind and 'reset --hard', you actually do *not* lose data
because the index changes are still in the stash.

Or spelled in a different way: you cannot undo the index changes and keep
only the worktree changes by 'stash --keep-index', 'reset --hard', 'stash
pop'.

-- Hannes
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[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]