From: Junio C Hamano <gitster@pobox.com>
To: しらいしななこ <nanako3@bluebottle.com>
Cc: "Uwe Kleine-König" <ukleinek@informatik.uni-freiburg.de>,
"Git Mailing List" <git@vger.kernel.org>
Subject: Re: [PATCH] stash: end commit log with a newline
Date: Wed, 04 Jul 2007 22:46:09 -0700 [thread overview]
Message-ID: <7vbqere732.fsf@assigned-by-dhcp.cox.net> (raw)
In-Reply-To: <200707042324.l64NOp8I019289@mi0.bluebottle.com> (nanako3@bluebottle.com's message of "Thu, 05 Jul 2007 08:18:27 +0900")
しらいしななこ <nanako3@bluebottle.com> writes:
> I am sorry to join the discussion late, but I think it is much better to let
> the user give a short reminder message from the command line. For example,
>
> $ git stash add customized message to stash
>
> When I say "git stash list", I want to see which branch I was on when I was
> in the middle of doing something, and what that something was. It is not
> interesting which commit on that branch I started that change from. After
> creating a stash without a message, and then another stash with a message, I
> want to see:
>
> $ git stash list
> stash@{0}: On master: add customized message to stash
> stash@{1}: WIP on master: 36e5e70... Start deprecating "git-command" in favor of "git command"
Hmph. I only recently got interested in "stash", so have not
enough real-life experience to base my judgement on, but I think
I'd agree with your reasoning.
Perhaps something like this?
-- >8 --
[PATCH] git-stash: allow more descriptive reminder message when saving
This allows you to say:
$ git stash starting to implement X
while creating a stash, and the resulting "stash list entry
would read as:
$ git stash list
stash@{0}: On master: starting to implement X
instead of the default message which talks about the commit the
stash happens to be based on (hence does not have much to do
with what the stashed change is trying to do).
Signed-off-by: Junio C Hamano <junkio@cox.net>
---
git-stash.sh | 25 +++++++++++++++++++------
1 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/git-stash.sh b/git-stash.sh
index 9deda44..3d7db4a 100755
--- a/git-stash.sh
+++ b/git-stash.sh
@@ -23,6 +23,8 @@ clear_stash () {
}
save_stash () {
+ stash_msg="$1"
+
if no_changes
then
echo >&2 'No local changes to save'
@@ -67,13 +69,19 @@ save_stash () {
die "Cannot save the current worktree state"
# create the stash
- w_commit=$(printf 'WIP on %s\n' "$msg" |
+ if test -z "$stash_msg"
+ then
+ stash_msg=$(printf 'WIP on %s' "$msg")
+ else
+ stash_msg=$(printf 'On %s: %s' "$branch" "$stash_msg")
+ fi
+ w_commit=$(printf '%s\n' "$stash_msg" |
git commit-tree $w_tree -p $b_commit -p $i_commit) ||
die "Cannot record working tree state"
- git update-ref -m "$msg" $ref_stash $w_commit ||
+ git update-ref -m "$stash_msg" $ref_stash $w_commit ||
die "Cannot save the current status"
- printf >&2 'Saved WIP on %s\n' "$msg"
+ printf >&2 'Saved "%s"\n' "$stash_msg"
}
have_stash () {
@@ -157,9 +165,14 @@ apply)
clear)
clear_stash
;;
-save | '')
- save_stash && git-reset --hard
+help)
+ usage
;;
*)
- usage
+ if test $# -gt 0 && test "$1" = save
+ then
+ shift
+ fi
+ save_stash "$*" && git-reset --hard
+ ;;
esac
--
Junio C Hamano
http://gitster.livejournal.com/
----------------------------------------------------------------------
No advertising message here ;-)
http://www.ohloh.net/projects/278
next parent reply other threads:[~2007-07-05 5:46 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <200707042324.l64NOp8I019289@mi0.bluebottle.com>
2007-07-05 5:46 ` Junio C Hamano [this message]
2007-07-05 11:58 ` [PATCH] stash: end commit log with a newline Uwe Kleine-König
2007-07-05 16:47 ` Junio C Hamano
2007-07-05 23:54 ` しらいしななこ
2007-07-03 8:59 Uwe Kleine-König
2007-07-03 11:29 ` Johannes Schindelin
2007-07-03 14:01 ` Uwe Kleine-König
2007-07-03 14:32 ` Jeff King
2007-07-04 5:10 ` しらいしななこ
2007-07-04 5:10 ` Junio C Hamano
2007-07-04 7:44 ` Uwe Kleine-König
2007-07-04 23:18 ` しらいしななこ
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=7vbqere732.fsf@assigned-by-dhcp.cox.net \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=nanako3@bluebottle.com \
--cc=ukleinek@informatik.uni-freiburg.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.