i'm experimenting with variations of "git stash" and i'm a bit puzzled by one of the save options. what is the effective difference between using --keep-index and using --no-keep-index when saving to the stash?
i did a simple experiment, and here's what happened. on a new branch for the linux kernel source, i edited the top-level Makefile, added a junk line, saved and staged. i then added a second line to that file, saved but did *not* stage, then did: $ git stash save --keep-index and here's what i found. according to what i've read, the reference to the last stash is saved in the file .git/refs/stash, so i grabbed the commit ID out of that file, and did a "git show" on it, and here's what i got: $ git show 70f534241092931d70f352591401e94898d01883 commit 70f534241092931d70f352591401e94898d01883 Merge: d2228e4 edbdb70 Author: Robert P. J. Day <rpj...@crashcourse.ca> Date: Wed Jun 24 06:30:49 2015 -0400 WIP on fred: d2228e4 Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending diff --cc Makefile index 3ba5044,920c22d..764ba77 --- a/Makefile +++ b/Makefile @@@ -1,3 -1,4 +1,5 @@@ + stage this line <----- ++but don't stage this line <----- VERSION = 4 PATCHLEVEL = 1 SUBLEVEL = 0 $ note the two lines i've added arrows to -- they clearly represent both the staged and unstaged changes to that file and i'm *assuming* that the first two characters are what stash to distinguish between staged and unstaged changes. i'm just *guessing* that "+ " means a staged change "++" represents an unstaged change am i guessing correctly? after all, stash needs *some* way to distinguish between staged and unstaged changes. i then dropped that stash element and did the same thing all over again, but this time i ran: $ git stash save --no-keep-index when i checked the details of what was stashed, it *looks* identical: $ git show e47cf959dfded3d55146ca741c9122d71d4694f2 commit e47cf959dfded3d55146ca741c9122d71d4694f2 Merge: d2228e4 69ca32f Author: Robert P. J. Day <rpj...@crashcourse.ca> Date: Wed Jun 24 06:33:57 2015 -0400 WIP on fred: d2228e4 Merge git://git.kernel.org/pub/scm/linux/kernel/git/nab/target-pending diff --cc Makefile index 3ba5044,920c22d..764ba77 --- a/Makefile +++ b/Makefile @@@ -1,3 -1,4 +1,5 @@@ + stage this line ++but don't stage this line VERSION = 4 PATCHLEVEL = 1 SUBLEVEL = 0 $ is there supposed to be some kind of difference? i do realize that when you come to pop, you can specify whether what was in the index should be restored to the index or not, but i'm just trying to figure out the functional difference when saving. thoughts? rday -- ======================================================================== Robert P. J. Day Ottawa, Ontario, CANADA http://crashcourse.ca Twitter: http://twitter.com/rpjday LinkedIn: http://ca.linkedin.com/in/rpjday ======================================================================== _______________________________________________ Linux mailing list Linux@lists.oclug.on.ca http://oclug.on.ca/mailman/listinfo/linux