Open
Description
There are a few stash variants that may also be helpful. The first option that is quite popular is the
--keep-index
option to thestash save
command. This tells Git to not stash anything that you've already staged with thegit add
command.
v2で追加されたこの段落、「git stash save --keep-index
でstashすると、git add
でインデックスに追加した内容はstashされないようにできる」という解釈で間違いないはず。けれど、このコマンドを実行すると、インデックスに追加されていた内容はstashされて、かつインデックスに残ったままになる。
ちなみに、ドキュメント には
If the --keep-index option is used, all changes already added to the index are left intact.
とある。
なお、git version 2.1.3(On ubuntu) と git version 1.9.4.msysgit.1 で試して同じ挙動だった。以下はgit version 2.1.3のログ。