Skip to content

git stash save --keep-index の記述と実際の動作に相違あり? #26

Open
@harupong

Description

@harupong

There are a few stash variants that may also be helpful. The first option that is quite popular is the --keep-index option to the stash save command. This tells Git to not stash anything that you've already staged with the git 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のログ。

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions