git stashコマンドでメッセージ付きで退避する方法
git stashコマンドでメッセージ付きで退避するにはpushサブコマンドで-mオプションを指定します。
オプションの説明
push [-p|--patch] [-k|--[no-]keep-index] [-u|--include-untracked] [-a|--all] [-q|--quiet] [-m|--message <message>] [--pathspec-from-file=<file> [--pathspec-file-nul]] [--] [<pathspec>...] Save your local modifications to a new stash entry and roll them back to HEAD (in the working tree and in the index). The <message> part is optional and gives the description along with the stashed state. For quickly making a snapshot, you can omit "push". In this mode, non-option arguments are not allowed to prevent a misspelled subcommand from making an unwanted stash entry. The two exceptions to this are stash -p which acts as alias for stash push -p and pathspec elements, which are allowed after a double hyphen -- for disambiguation.
-mオプションを指定した場合
$ git stash list stash@{0}: On master: test stash@{1}: On master: with message stash@{2}: WIP on master: 8b7c11b866 The fifth batch $ git stash push -m "new entry" Saved working directory and index state On master: new entry $ git stash list stash@{0}: On master: new entry stash@{1}: On master: test stash@{2}: On master: with message stash@{3}: WIP on master: 8b7c11b866 The fifth batch
-mオプションを指定しない場合
$ git stash list stash@{0}: On master: test stash@{1}: On master: with message stash@{2}: WIP on master: 8b7c11b866 The fifth batch $ git stash push Saved working directory and index state WIP on master: 8b7c11b866 The fifth batch $ git stash list stash@{0}: WIP on master: 8b7c11b866 The fifth batch stash@{1}: On master: test stash@{2}: On master: with message stash@{3}: WIP on master: 8b7c11b866 The fifth batch