Unexpected behaviour with git stash save --keep-index?

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

 



Hello all,

while I was using StGit for the first time and used git stash to split
the changes into different patches I noticed that git stash save -- keep-index will stash also the changes that are already in the index. This was unexpected
atleast to me but maybe someone can explain why it's correct.

The following sequence should illustrate the problem. Notice how both the
b and c are popped from the stash.

git init
echo a > test.txt
git add test.txt
git commit -m "a"
echo b >> test.txt
git add test.txt
echo c >> test.txt
git stash save --keep-index
git commit -m "b"
git checkout -b new_branch HEAD^
git stash pop
git diff

Also maybe someone could someone recommend a way to split an unclean working dir
into several patches/commits?

With regards

Jonas

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

  Powered by Linux