-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature Request] Rename stashes #218
Comments
Great idea since whenever I create stashes at the command line, I always forget to give them names. |
@nebhale that’s exactly my usecase too! |
I made some research and I could not find any easy way to rename a stash. Any idea how this could be done? |
My old hack: Apply, stash save w/ name, delete old stash. |
@fbartho it also requires user to have clean working directory :(. There's a hack: https://stackoverflow.com/questions/25931026/how-can-i-rename-a-git-stash#35549615. But it does not really rename stash, it only changes reflog message. In this way new message will be displayed when you call |
Oh! I found |
why is this closed? it is a legit feature request with a defined solution? |
This is a legit feature request, but I don't know a way to rename a stash. I think currently it's simply not possible. |
I think have I figured out a way to do this. I have described it in this StackOverflow answer. Fork does have an issue with the newly created stash, however. The first character of the stash message is missing. The GitLens VSCode plugin does show the stash message properly in its list of stashes, however. Related to this, I noticed that Fork hides the |
@brechtm this looks like a correct approach. I will have a look. Just a note: a stash can have 3 parents when it's created with the |
Thanks for the heads-up. I've now mentioned that in the SO answer. |
Alright, we have a working version! Would you like to try it? https://cdn.fork.dev/mac/Fork-2.2.3.dmg The usage is simple, stash rename is available in the context menu in the commit list and on the sidebar. |
@DanPristupov I was able to test it! and it worked! Nuance for anybody surprised -- when you rename a stash, it moves to the top of the stack, but that's an acceptable detail imho. |
Yup, works great!
I would also prefer that the ordering to stay the same. If the stashes are sorted by date, the original stash commit's timestamp could perhaps be copied? |
@brechtm I believe the stashes are numbered / ordered automatically (not dynamically sorted based on any particular criteria). It wouldn't surprise me if it were impossible to rename "in-place" without changing the order. |
@fbartho Ah yes, I forgot the stashes are part of a stack, and numbered based on their position. Poking around a bit, I learned that the stash list is basically shoehorned into a reflog. I was able to reorder the stashes by swapping lines of Editing that file may not be a good idea though. Perhaps it's possible to edit one of the entries in this file using plumbing commands? In any case, even with the renamed stash jumping to the top, this is still a very useful feature to have as-is. Much appreciated, @DanPristupov! Perhaps in-place renaming (and arbitrary stash reordering?) can be added at a later point in time. |
Please add the F2 shortcut to be consistent with branch renaming. |
Right-click menu on stash entries allows user to
Apply
a stash orDelete
a stash, (which I was happy to discover).It'd be nice if there was a built-in helper that would rename stashes as well.
The text was updated successfully, but these errors were encountered: