Chris Torek <chris.torek <at> gmail.com> writes: > > When "git stash" does its work, if the index and the work > directory are out of sync, but the work directory is in sync with > the HEAD commit, the work directory commit does not contain the > file in its work-directory state, but rather in its index-state. I too encountered this bug while trying to design a custom pre-commit hook that would speculatively change the working tree and then "stash pop" its changes. Chris Torek alerted me to it on StackOverflow: http://stackoverflow.com/questions/25536034/modifying-working-directory-and- staging-area-temporarily-in-git-pre-commit-hook Another small issue I had in solving the same problem: there's no way to tell if "git stash save" has created a new stash or not, so it's hard to figure out whether one should be popped later. It would be helpful if there were a specific non-zero return code assigned when no stash was generated due to no changes requiring it. Here's a simple patch for that: --- a/git-stash +++ b/git-stash @@ -220,8 +220,7 @@ save_stash () { git update-index -q --refresh if no_changes then - say "$(gettext "No local changes to save")" - exit 0 + die_with_status 9 "$(gettext "No local changes to save")" fi test -f "$GIT_DIR/logs/$ref_stash" || clear_stash || die "$(gettext "Cannot initialize stash")" Thanks, Dan -- 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