{"thread":{"id":"35969","subject":"Re: `git stash pop` UX Problem","startedAt":"2014-02-27T11:23:18Z","lastAt":"2014-02-27T11:23:18Z","messageCount":1,"participants":["Damien Robert"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"235456","messageId":"20140227112317.GC1215@feanor","threadId":"35969","inReplyTo":null,"subject":"Re: `git stash pop` UX Problem","fromName":"Damien Robert","fromEmail":"damien.olivier.robert@gmail.com","sentAt":"2014-02-27T11:23:18Z","receivedAt":"2014-02-27T11:23:18Z","isPatch":false,"sender":{"key":"damien.olivier.robert@gmail.com","avatar":null},"body":"Matthieu Moy  wrote in message <vpqzjlf5q2z.fsf@anie.imag.fr>:\n>> Maybe status should display a stash count if that count is > 0, as\n>> this is part of the state of the repo.\n> Maybe it would help some users, but not me for example. My main use of\n> \"git stash\" is a safe replacement for \"git reset --hard\": when I want to\n> discard changes, but keep them safe just in case.\n> So, my stash count is almost always >0, and I don't want to hear about\n> it.\n\nRelated to your comment, I adapted git-stash\n  https://gist.github.com/DamienRobert/9227034\nto have the following (mis)features:\n\n- There is a global --ref option that allows to specify the reference the\n  stash will use (by default this is refs/mystash, git-stash.sh uses\n  refs/stash).\n\n  This allows to differenciate between different uses of stashes: save WIP\n  before switching branch; keep a backup before a git reset;...\n\n- There is a new command `git mystash dosave` that works like git stash but\n  does not reset the worktree afterwards. Note that `git stash create`\n  already does that, but it handles options differently than `git stash\n  save`. `git mystash dosave` can be seen as a wrapper around `git stash\n  create`.\n  The reason is that while `git stash create` is intended for scripts, `git\n  mystash dosave` is intended for the UI. One example of when we don't want\n  to drop the worktree is when we want to do a `git checkout -m -- paths`\n  but we want to save the current state in case the merge has conflicts.\n\n- `git stash branch` pops the stash once the branch is created. I did not\n  like this feature so `git mystash branch` does not pop the stash; use `git\n  mystash popbranch` to have the original meaning of `git stash branch`.\n\n- `git mystash save` (and `git stash dosave`) has a new option\n  `--on-branch` which stores the stash onto the current branch rather than\n  in $ref_stash. The idea is that when I use `git stash` for a WIP, then\n  when I come back to the original branch I always forget that I had a\n  stash for this branch, and if there were several WIP in between it can be\n  hard to remember which stash to apply. With `--on-branch`, when I come\n  back to the original branch I am now on the stash, and I know I just need\n  to apply it. For that `git mystash apply` (or `git mystash pop`) also has\n  a `--on-branch` option that tells it to use the stash on the current\n  branch.\n\n- `git mystash info` gives informations about a stash.\n\nSo obviously not all of these would be good for inclusion into git, but\nmaybe some of them would be somewhat worth it. When I have the time I'll\ntry to write tests and send proper patches.\n\n-- \nDamien Robert\n"}]}