git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Proposal for git stash rename

From
GHGreg Hewgill <greg@hewgill.com>
Date
Jun 20, 2010, 09:31 UTC
Message-ID
<20100620093142.GF24805@occam.hewgill.net>

I'd like to teach git-stash to rename stashes. Sometimes I'll create a stash and then later think of a better or more descriptive name for it. Or, I'll create a stash with "git stash -p" and forget to give it a useful name, and there's no easy way to undo and redo that without doing the interactive part again.

I noticed that although the stash message is used as the commit description for the stash commit(s), it is the message in the reflog that is actually displayed on "git stash list". So to rename a stash, changing the message in the reflog is sufficient (this can be demonstrated with a text editor).

My general idea is:
1. Implement a new "git reflog update" command that updates the message
associated with a specific reflog entry. To do this, a new
update_reflog_ent() function (in reflog.c) would change the message
associated with the specific reflog entry to update. An update_reflog()
function would use for_each_reflog_ent() with update_reflog_ent to
actually do the change.
2. A "git stash rename" command would then only need to call "git
reflog update" with the appropriate ref and new message.

Since this is my first time modifying the Git source, I thought I'd solicit some feedback on this idea.

- Is this an appropriate approach to implementing this?
- Is there a better way to do it?
- I have a mostly working patch now, but it needs cleanup. What's the
  next step?

Greg Hewgill http://hewgill.com

Next: Ævar Arnfjörð Bjarmason
Message 1 of 6 in “Proposal for git stash rename”
  1. Greg HewgillJun 20, 2010
  2. Ævar Arnfjörð BjarmasonJun 20, 2010
  3. Greg HewgillJun 20, 2010
  4. Micheil SmithJan 4, 2013
  5. Junio C HamanoJan 4, 2013
  6. Michael HaggertyJan 9, 2013

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.