{"thread":{"id":"63256","subject":"Make 'git stash list' more informative","startedAt":"2025-04-05T04:12:28Z","lastAt":"2025-04-08T02:06:28Z","messageCount":4,"participants":["Yuri","Lucas Seiki Oshiro","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"515690","messageId":"edcd6174-e931-4ab9-b61d-8126a6cab740@rawbw.com","threadId":"63256","inReplyTo":null,"subject":"Make 'git stash list' more informative","fromName":"Yuri","fromEmail":"yuri@rawbw.com","sentAt":"2025-04-05T04:12:26Z","receivedAt":"2025-04-05T04:12:28Z","isPatch":false,"sender":{"key":"yuri@rawbw.com","avatar":null},"body":"Currently 'git stash list' prints lines like this:\nstash@{10}: WIP on main: 3f802b772d88 science/py-pymatgen: update \n2025.1.24 → 2025.2.18\n\n\nIt contains the last commit's subject which often/usually doesn't really \ndescribe the stash entry.\n\n\nI propose to amend WIP stash entry descriptions with size, number of \ndirs and files, and time description, so that the above entry might look \nlike this:\n\nstash@{10}: WIP on main: 3f802b772d88 science/py-pymatgen: update \n2025.1.24 → 2025.2.18 (+20, -5, 3 dirs, 5 files, 17 days ago)\n\n\n\nIt would add info about the number of changed lines, number of affected \ndirectories and files, and how old this stash record is.\n\n\nThis would make WIP stash lines much more informative and they would \nactually describe better what is in them.\n\n\n\n\nThanks,\nYuri\n\n"},{"id":"515699","messageId":"29E4ED32-4909-48EF-86BB-67111B62AE1A@gmail.com","threadId":"63256","inReplyTo":"edcd6174-e931-4ab9-b61d-8126a6cab740@rawbw.com","subject":"Re: Make 'git stash list' more informative","fromName":"Lucas Seiki Oshiro","fromEmail":"lucasseikioshiro@gmail.com","sentAt":"2025-04-05T16:24:02Z","receivedAt":"2025-04-05T16:39:49Z","isPatch":false,"sender":{"key":"lucasseikioshiro@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12701580?v=4"},"body":"> It contains the last commit's subject which often/usually doesn't really describe the stash entry.\n\n`git stash list` accepts the options from `git log`, so you can change\nlook at its manpage to find other options that show the information\nthat you want.\n\n> I propose to amend WIP stash entry descriptions with size, number of dirs and files\n\nPerhaps this helps you:\n\n`git stash list --stat --pretty=reference`\n\nYou can customize following the format described on https://git-scm.com/docs/pretty-formats.\n\n> Thanks,\n> Yuri\n\nI hope it helps you!"},{"id":"515805","messageId":"xmqqiknflj8j.fsf@gitster.g","threadId":"63256","inReplyTo":"29E4ED32-4909-48EF-86BB-67111B62AE1A@gmail.com","subject":"Re: Make 'git stash list' more informative","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2025-04-07T22:06:20Z","receivedAt":"2025-04-07T22:06:23Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Lucas Seiki Oshiro <lucasseikioshiro@gmail.com> writes:\n\n>> It contains the last commit's subject which often/usually doesn't\n>> really describe the stash entry.\n\nIt depends on how you work.\n\nI do agree that the work recorded in the stash entries tend to be\npretty much unrelated to the work I was doing on the branch (hence\nthe theme of the base commit).  After all, if they are related,\nyou're more likely not keeping the work in the stash entries---you'd\nrather be making completed commit on the branch.\n\nHowever, I find that the subject of the base commit the stashed work\nwas derived from works well as a memory aid to recall what I was\nworking on when the stash entry was created.\n\nSo \"doesn't really describe\" is correct, but because stash is by\ndesign a local thing, it is not a failure that it \"doesn't really\ndescribe\"---the purpose of the message is to be something easily\ngenerated and help jog your memory later.\n\nHaving said that ...\n\n> `git stash list` accepts the options from `git log`, so you can change\n> look at its manpage to find other options that show the information\n> that you want.\n\n... this is an excellent suggestion.\n\nThanks.\n"},{"id":"515817","messageId":"73A1707C-7B41-42C4-A530-E107FB8D5227@gmail.com","threadId":"63256","inReplyTo":"xmqqiknflj8j.fsf@gitster.g","subject":"Re: Make 'git stash list' more informative","fromName":"Lucas Seiki Oshiro","fromEmail":"lucasseikioshiro@gmail.com","sentAt":"2025-04-08T02:06:13Z","receivedAt":"2025-04-08T02:06:28Z","isPatch":false,"sender":{"key":"lucasseikioshiro@gmail.com","avatar":"https://avatars.githubusercontent.com/u/12701580?v=4"},"body":"\n> After all, if they are related,\n> you're more likely not keeping the work in the stash entries---you'd\n> rather be making completed commit on the branch.\n\nI don't if this the use case of Yuri, but in the past I kept a stash\nentry with some local development changes that shouldn't be committed\nand sent to the main repository. This is, I always applied that stash\nentry, did what I needed in my local environment, removed the code\nthat was applied, then I committed the changes that should went to\nproduction.\n\nIt soon became hard to manage as I needed to use stash for other\nthings. But hey, stash entries are commits, so I could somehow mimic\nits behavior without using stash itself! So, what I did:\n\n1. Detached the HEAD:\n\n$ git checkout --detach\n\n2. Committed the local development changes. You can use the commit\nmessage body to write a description of what those changes are.\n\n$ git add my_changed_file\n$ git commit\n\n3. Created a local tag, just for me:\n\n$ git tag LOCAL_SETUP\n\n4. Whenever I wanted to use that code, I just applied it by using:\n\n$ git merge --squash LOCAL_SETUP\n$ git reset\n\nThis left the Git stash stack free for other uses and I could use\nit without worrying about the stash positions. If the problem is\nto have control over the stash, maybe the solution is to use the\ngood old commits.\n\n> ... this is an excellent suggestion.\n\nThanks :-)\n"}]}