git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* please change stash
       [not found] <76c2d8b6-b001-8ae5-4e66-fdeed4a1190a@pannous.com>
@ 2018-02-12 15:04 ` Karsten Fluegge
  2018-02-13  0:52   ` Andrew Ardill
  0 siblings, 1 reply; 2+ messages in thread
From: Karsten Fluegge @ 2018-02-12 15:04 UTC (permalink / raw)
  To: git

Dear great team,

Normal git tooling creates different files file.ORIG file.LOCAL
file.REMOTE in case of conflicts.

However `git stash pop` manipulates your files directly resulting in
lines like:

<<<<<<< Updated upstream

>>>>>>> Stashed changes

This can seriously corrupt files and workflows.

If it is «the user's fault» or negligence then at least we're not the
only one:

https://github.com/search?q=Stashed+changes&type=Code

300000 'idiots' might hint at a UX problem. (factor 10 in darknet)

-- 
Kind regards,
Karsten Flügge, CEO
GmbH

Hagenkampsweg 10
25474 Hasloh
Germany

Mobile +49-176-64638989   
Support +1-855-447-2666
E-Mail info@pannous.com
Homepage pannous.com

Handelsregister: Amtsgericht Pinneberg HRB 7795 PI
Sitz der Gesellschaft: Hasloh
Steuernummer: 18/291/16961
USt-Id Nr: DE264064657
CEO: Karsten Flügge


-- 
Kind regards,
Karsten Flügge, CEO
GmbH

Hagenkampsweg 10
25474 Hasloh
Germany

Mobile +49-176-64638989   
Support +1-855-447-2666
E-Mail info@pannous.com
Homepage pannous.com

Handelsregister: Amtsgericht Pinneberg HRB 7795 PI
Sitz der Gesellschaft: Hasloh
Steuernummer: 18/291/16961
USt-Id Nr: DE264064657
CEO: Karsten Flügge


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: please change stash
  2018-02-12 15:04 ` please change stash Karsten Fluegge
@ 2018-02-13  0:52   ` Andrew Ardill
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Ardill @ 2018-02-13  0:52 UTC (permalink / raw)
  To: Karsten Fluegge; +Cc: git

Hi Karsten,

> Normal git tooling creates different files file.ORIG file.LOCAL
> file.REMOTE in case of conflicts.

Which tools are you referring to here? Can you give a short sequence
of commands that show what you mean?

> However `git stash pop` manipulates your files directly resulting in
> lines like:
>
> <<<<<<< Updated upstream
>
>>>>>>>> Stashed changes
>
> This can seriously corrupt files and workflows.

This looks like a normal merge conflict. I suspect that you are using
tools that know how to deal with this format when it used the merge
conflict markers, but maybe not the equivalent markers you get when
popping a conflicting stash.

To demonstrate, here is a short script:

git init test
cd test
echo "base file" >test
git commit -m "base file"
git add test
git commit -m "base file"
git checkout -b conflict_branch
echo "conflicting file" >test
git commit -am "conflict file"
git checkout master
echo "updated file" >test
git commit -am "updated file"
git merge conflict_branch


This merge fails, and the file 'test' looks like this:

<<<<<<< HEAD
updated file
=======
conflicting file
>>>>>>> conflict_branch

As you can see, this sequence of actions doesn't result in 3 different files.

The merge conflict format is a relatively old one, and lots of tools
know how to use it in different ways (such as the tool you are using,
I presume) but say this was to be changed for the stash operation -
what would you propose replace it?
Some options might be to:
- instead of placing the conflicts in the original file, place the
different conflicting versions into different files
- warn when adding/committing/pushing files with conflict markers in them
- teach the tool you are using to handle the stash conflict markers in
a nicer way

Some of these may be possible to do with little work.
This link[0] on stack overflow deals with creating separate files, and
it looks like it might work for stash pop conflicts.
This one[1] shows how to create hooks that catch any conflicts that
are being committed, and would also probably work with stash
conflicts.

Teaching the tool to handle stash conflicts, or making any of the
above changes to the base distribution of git would be significantly
harder, but maybe this can help you in the meantime.

Regards,

Andrew Ardill

[0] https://stackoverflow.com/questions/47512337/configure-git-to-create-multiple-files-for-merge-conflicts
[1] https://stackoverflow.com/questions/24213948/prevent-file-with-merge-conflicts-from-getting-committed-in-git

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-02-13  0:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <76c2d8b6-b001-8ae5-4e66-fdeed4a1190a@pannous.com>
2018-02-12 15:04 ` please change stash Karsten Fluegge
2018-02-13  0:52   ` Andrew Ardill

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).