Re: `git stash pop` UX Problem

3 messages, 3 authors, 2016-06-15 · open the first message on its own page

Re: `git stash pop` UX Problem

From: Junio C Hamano <hidden>
Date: 2016-06-15 22:59:59

Matthieu Moy [off-list ref] writes:
Holger Hellmuth [off-list ref] writes:
quoted
Am 24.02.2014 17:21, schrieb Matthieu Moy:
quoted
$ git add foo.txt
$ git status
On branch master
Changes to be committed:
   (use "git reset HEAD <file>..." to unstage)

         modified:   foo.txt
Maybe status should display a stash count if that count is > 0, as
this is part of the state of the repo.
Maybe it would help some users, but not me for example. My main use of
"git stash" is a safe replacement for "git reset --hard": when I want to
discard changes, but keep them safe just in case.

So, my stash count is almost always >0, and I don't want to hear about
it.
"status" is about reminding the user what changes are already in the
index (i.e. what you would commit) and what changes are in the
working tree, from which you could further update the index with
(i.e. what you could commit).

One _could_ argue that stashed changes are what could be reflected
to the working tree and form the source of the latter, but my gut
feeling is that it is a rather weak argument.  At that point you are
talking about what you could potentially change in the working tree,
and the way to do so is not limited to "stash pop" (i.e. you can
"git cherry-pick --no-commit $a_commit", or "edit" any file in the
working tree for that matter, with the same ease).

So, I tend to agree with you, while I do understand where "I want to
know about what is in stash" is coming from (and that is why we do
have "git stash list" command).

Re: `git stash pop` UX Problem

From: Omar Othman <hidden>
Date: 2016-06-15 23:00:00

Matthieu Moy [off-list ref] writes:
quoted
Holger Hellmuth [off-list ref] writes:
quoted
Am 24.02.2014 17:21, schrieb Matthieu Moy:
quoted
$ git add foo.txt
$ git status
On branch master
Changes to be committed:
    (use "git reset HEAD <file>..." to unstage)

          modified:   foo.txt
Maybe status should display a stash count if that count is > 0, as
this is part of the state of the repo.
Maybe it would help some users, but not me for example. My main use of
"git stash" is a safe replacement for "git reset --hard": when I want to
discard changes, but keep them safe just in case.

So, my stash count is almost always >0, and I don't want to hear about
it.
"status" is about reminding the user what changes are already in the
index (i.e. what you would commit) and what changes are in the
working tree, from which you could further update the index with
(i.e. what you could commit).

One _could_ argue that stashed changes are what could be reflected
to the working tree and form the source of the latter, but my gut
feeling is that it is a rather weak argument.  At that point you are
talking about what you could potentially change in the working tree,
and the way to do so is not limited to "stash pop" (i.e. you can
"git cherry-pick --no-commit $a_commit", or "edit" any file in the
working tree for that matter, with the same ease).

So, I tend to agree with you, while I do understand where "I want to
know about what is in stash" is coming from (and that is why we do
have "git stash list" command).
Same comment. Everyone will have his own opinion. As long as the messages are not customizable, we can debate for hours and everybody has a valid point.

Re: `git stash pop` UX Problem

From: Theodore Ts'o <tytso@mit.edu>
Date: 2016-06-15 23:00:00

On Tue, Feb 25, 2014 at 11:12:10AM -0800, Junio C Hamano wrote:
So, I tend to agree with you, while I do understand where "I want to
know about what is in stash" is coming from (and that is why we do
have "git stash list" command).
One thing that would be nice is if there was built-in "git stash list"
option which only shows the stash items which match the current
branch.  The discussion on this thread inspired me to create the
following:

#!/bin/sh

b=$(git symbolic-ref HEAD | sed -e 's;refs/heads/;;')
git stash list --pretty="%gd %cr on: %s" | grep "WIP on $b" | \
    sed -e "s/ WIP on $b: [0-9a-f]*//"

This results in:

stash@{0} 4 weeks ago on: mke2fs: add make_hugefile feature
stash@{1} 5 weeks ago on: e2fsck, mke2fs: enable octal integers in the profile/config file
stash@{2} 5 weeks ago on: e2fsck, mke2fs: enable octal integers in the profile/config file
stash@{3} 5 weeks ago on: mke2fs: optimize fix_cluster_bg_counts()
stash@{4} 8 weeks ago on: e4defrag: choose the best available posix_fadvise variant
stash@{5} 9 weeks ago on: e2image: add -c option to optimize file system copying for flash devices
stash@{6} 9 weeks ago on: e2image: clean up gcc -Wall and sparse nits
stash@{7} 9 weeks ago on: e2fsck: fix printf conversion specs in ea_refcount.c

(Yes, I have a lot of junk on my git stash; showing the relative time
is going to help my GC what I have left on my git stash list.)

Cheers,

						- Ted
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help