please change stash

2 messages, 2 authors, 2018-02-13 · open the first message on its own page

please change stash

From: Karsten Fluegge <hidden>
Date: 2018-02-12 15:05:01

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
quoted
quoted
quoted
quoted
quoted
quoted
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

Re: please change stash

From: Andrew Ardill <hidden>
Date: 2018-02-13 00:53:06

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
quoted
quoted
quoted
quoted
quoted
quoted
quoted
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
quoted
quoted
quoted
quoted
quoted
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help