{"thread":{"id":"56422","subject":"Concept question about push/pull stashes","startedAt":"2021-09-01T07:44:31Z","lastAt":"2021-09-01T09:23:39Z","messageCount":2,"participants":["c.buhtz@posteo.jp","Philip Oakley"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"434397","messageId":"8d2f05e6f4ff9855460402e8cdafd7e7@posteo.de","threadId":"56422","inReplyTo":null,"subject":"Concept question about push/pull stashes","fromName":"","fromEmail":"c.buhtz@posteo.jp","sentAt":"2021-09-01T07:44:23Z","receivedAt":"2021-09-01T07:44:31Z","isPatch":false,"sender":{"key":"c.buhtz@posteo.jp","avatar":null},"body":"Hello,\nmy question has to goals. I want to understand the design decisions \nbehind a (missing) feature and and wan't to explore the needs of other \nusers before I start to implement something.\n\nThere is no usual way to exchange stashes with other repos/users. \nStashes are code snippets that are unfinished and not clean enough to \ncommit them anywhere not even in another branch.\n\nWhy? What is the concept behind this? I am sure this was well thought. I \njust try to understand.\n\nA feature like this is often asked by users when you asked the search \nengine of your trust.\n\nOne workaround is to simply commit the stashed code, push/pull it, \ncheckoutit into the other repo and delete the last commit.\n\nThe other workaround is to create a patch-file from a stash. But then \nthe question is how to exchange this file?\n\nWhy not use the git infrastructure itself?\n\nI have workaround in my mind. I couuld use a script wich creates patch \nfiles for each existing stash and commit them into the repo. Thats all. \nTo keep the repo \"clean\" the path files could be archived into a hidden \n(dotted filed) tar file. Or the tar file could be stored inside the \n\".git\" folder if there is a way.\n\nI am interested in your thoughts about this.\n"},{"id":"434404","messageId":"204f8fdb-2e98-f1d2-b01b-d1e0fb0cf8b2@iee.email","threadId":"56422","inReplyTo":"8d2f05e6f4ff9855460402e8cdafd7e7@posteo.de","subject":"Re: Concept question about push/pull stashes","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.email","sentAt":"2021-09-01T09:23:35Z","receivedAt":"2021-09-01T09:23:39Z","isPatch":false,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"This is a bit of 30,000ft thinko.\n\nOn 01/09/2021 08:44, c.buhtz@posteo.jp wrote:\n> Hello,\n> my question has to goals. I want to understand the design decisions\n> behind a (missing) feature and and wan't to explore the needs of other\n> users before I start to implement something.\n>\n> There is no usual way to exchange stashes with other repos/users.\n> Stashes are code snippets that are unfinished and not clean enough to\n> commit them anywhere not even in another branch.\n\nI suspect that this \"not even in another branch\" is where the confusion\nmay arise. I've always understood git branches to be lightweight and\nephemeral. We usually fail to take that mental model to its rightful\nconclusion.\n\nWhile some branches are rock solid release branches, that does not\npreclude their use for whimsical, unfinished snippets of code. There can\nbe reticence to create local wip branches (a trap I often fall into)\nwhen we should be far more free with our branches - they take up no space!\n\nUltimately stashes are branches, their _extra_ capability is that they\ncan handle un-staged changes and other _local_ changes to allow for\ninterruptions.\n\n>\n> Why? What is the concept behind this? I am sure this was well thought.\n> I just try to understand.\n>\n> A feature like this is often asked by users when you asked the search\n> engine of your trust.\n>\n> One workaround is to simply commit the stashed code, push/pull it,\n> checkoutit into the other repo and delete the last commit.\n\nIf the commit was on a new [wip] branch then a later branch deletion and\n`gc` will clear it.\n\nIsn't this an XYproblem for how to exchange snippets? And how to\ndecide/indicate what should be in the snippet?\n\n>\n> The other workaround is to create a patch-file from a stash. But then\n> the question is how to exchange this file?\n\n`send-email` ?\n>\n> Why not use the git infrastructure itself?\n>\n> I have workaround in my mind. I couuld use a script wich creates patch\n> files for each existing stash and commit them into the repo. Thats\n> all. To keep the repo \"clean\" the path files could be archived into a\n> hidden (dotted filed) tar file. Or the tar file could be stored inside\n> the \".git\" folder if there is a way.\n\nThe stash does manage to combine the selection of the code change files\nand creation of a branch [aka stash]. Maybe `commit` needs a --wip\noption that will create the branch while adding the selected files.  The\n'transmission' method would also need resolving as there are too many\nways folk interact these days - we already have patches, tar files,\nremote push/fetch, then there will be web browsing methods..\n\n>\n> I am interested in your thoughts about this.\n\nThere is always (after checking the manual) `git stash branch\n<branchname> [<stash>]`  - not used it myself, so it may not do what I\nthink I read.. Sounds like it needs combining with an initial `stash\npush` to allow the new branch (containing the stash snippet) to be\nexchanged using the regular methods for on-branch code.\n\n-- \nPhilip\n"}]}