{"thread":{"id":"47817","subject":"please change stash","startedAt":"2018-02-12T15:05:01Z","lastAt":"2018-02-13T00:53:06Z","messageCount":2,"participants":["Karsten Fluegge","Andrew Ardill"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"339080","messageId":"5f712f6e-ecb4-db85-02de-b48be1bf1f44@pannous.com","threadId":"47817","inReplyTo":"76c2d8b6-b001-8ae5-4e66-fdeed4a1190a@pannous.com","subject":"please change stash","fromName":"Karsten Fluegge","fromEmail":"info@pannous.com","sentAt":"2018-02-12T15:04:49Z","receivedAt":"2018-02-12T15:05:01Z","isPatch":false,"sender":{"key":"info@pannous.com","avatar":null},"body":"Dear great team,\n\nNormal git tooling creates different files file.ORIG file.LOCAL\nfile.REMOTE in case of conflicts.\n\nHowever `git stash pop` manipulates your files directly resulting in\nlines like:\n\n<<<<<<< Updated upstream\n\n>>>>>>> Stashed changes\n\nThis can seriously corrupt files and workflows.\n\nIf it is «the user's fault» or negligence then at least we're not the\nonly one:\n\nhttps://github.com/search?q=Stashed+changes&type=Code\n\n300000 'idiots' might hint at a UX problem. (factor 10 in darknet)\n\n-- \nKind regards,\nKarsten Flügge, CEO\nGmbH\n\nHagenkampsweg 10\n25474 Hasloh\nGermany\n\nMobile +49-176-64638989   \nSupport +1-855-447-2666\nE-Mail info@pannous.com\nHomepage pannous.com\n\nHandelsregister: Amtsgericht Pinneberg HRB 7795 PI\nSitz der Gesellschaft: Hasloh\nSteuernummer: 18/291/16961\nUSt-Id Nr: DE264064657\nCEO: Karsten Flügge\n\n\n-- \nKind regards,\nKarsten Flügge, CEO\nGmbH\n\nHagenkampsweg 10\n25474 Hasloh\nGermany\n\nMobile +49-176-64638989   \nSupport +1-855-447-2666\nE-Mail info@pannous.com\nHomepage pannous.com\n\nHandelsregister: Amtsgericht Pinneberg HRB 7795 PI\nSitz der Gesellschaft: Hasloh\nSteuernummer: 18/291/16961\nUSt-Id Nr: DE264064657\nCEO: Karsten Flügge\n\n"},{"id":"339133","messageId":"CAH5451=YvnrjWreagLMCjMuGTgc-mfoL-MncRrda1PXuEQSCiA@mail.gmail.com","threadId":"47817","inReplyTo":"5f712f6e-ecb4-db85-02de-b48be1bf1f44@pannous.com","subject":"Re: please change stash","fromName":"Andrew Ardill","fromEmail":"andrew.ardill@gmail.com","sentAt":"2018-02-13T00:52:20Z","receivedAt":"2018-02-13T00:53:06Z","isPatch":false,"sender":{"key":"andrew.ardill@gmail.com","avatar":"https://gravatar.com/avatar/da14cb7c091dd44dc6c63a4d3361b149acaf25226dc78eb4131a17b93d9b0993?d=mp&s=160"},"body":"Hi Karsten,\n\n> Normal git tooling creates different files file.ORIG file.LOCAL\n> file.REMOTE in case of conflicts.\n\nWhich tools are you referring to here? Can you give a short sequence\nof commands that show what you mean?\n\n> However `git stash pop` manipulates your files directly resulting in\n> lines like:\n>\n> <<<<<<< Updated upstream\n>\n>>>>>>>> Stashed changes\n>\n> This can seriously corrupt files and workflows.\n\nThis looks like a normal merge conflict. I suspect that you are using\ntools that know how to deal with this format when it used the merge\nconflict markers, but maybe not the equivalent markers you get when\npopping a conflicting stash.\n\nTo demonstrate, here is a short script:\n\ngit init test\ncd test\necho \"base file\" >test\ngit commit -m \"base file\"\ngit add test\ngit commit -m \"base file\"\ngit checkout -b conflict_branch\necho \"conflicting file\" >test\ngit commit -am \"conflict file\"\ngit checkout master\necho \"updated file\" >test\ngit commit -am \"updated file\"\ngit merge conflict_branch\n\n\nThis merge fails, and the file 'test' looks like this:\n\n<<<<<<< HEAD\nupdated file\n=======\nconflicting file\n>>>>>>> conflict_branch\n\nAs you can see, this sequence of actions doesn't result in 3 different files.\n\nThe merge conflict format is a relatively old one, and lots of tools\nknow how to use it in different ways (such as the tool you are using,\nI presume) but say this was to be changed for the stash operation -\nwhat would you propose replace it?\nSome options might be to:\n- instead of placing the conflicts in the original file, place the\ndifferent conflicting versions into different files\n- warn when adding/committing/pushing files with conflict markers in them\n- teach the tool you are using to handle the stash conflict markers in\na nicer way\n\nSome of these may be possible to do with little work.\nThis link[0] on stack overflow deals with creating separate files, and\nit looks like it might work for stash pop conflicts.\nThis one[1] shows how to create hooks that catch any conflicts that\nare being committed, and would also probably work with stash\nconflicts.\n\nTeaching the tool to handle stash conflicts, or making any of the\nabove changes to the base distribution of git would be significantly\nharder, but maybe this can help you in the meantime.\n\nRegards,\n\nAndrew Ardill\n\n[0] https://stackoverflow.com/questions/47512337/configure-git-to-create-multiple-files-for-merge-conflicts\n[1] https://stackoverflow.com/questions/24213948/prevent-file-with-merge-conflicts-from-getting-committed-in-git\n"}]}