How to specify default merge strategy to git stash pop
Side note: you don't want --theirs
- this is an option git checkout
, not a merge - and -s theirs
there is no strategy , there is only a strategy strategy -X theirs
(I like to call these "advanced options" to distinguish them from strategies -s
).
The answer, however, is that you can't: it simply isn't supported as part of the code git stash
.
This can be done in a different way. git stash
script , which is a wrapper script, you can copy and modify or run your various bits piece by piece, works git merge-recursive $b_tree -- $c_tree $w_tree
for a fixed tree merge. You can do it yourself, manually, or by copying and modifying the script, with additional -X
advanced options. However, this does not guarantee what you want . This will only affect the parts that Git thinks they are in conflict, and in this case it will support one side or the other: -X ours
means the approval of changes $b_tree
-to- $c_tree
instead $b_tree
to $w_tree
change, and -X theirs
is changing $b_tree
to $w_tree
. Perhaps you might want the whole file from$w_tree
made, although or did not accept, some changes, which, nevertheless, do not conflict.
(It would be easier and simpler to make your own commit, which you could do on a private branch, then you can check out the individual files and / or do whatever you like from that commit at any time and don't have to worry about specific internal details git stash
script that might change from one version of Git to another. Note that to merge one specific file at a time, you can use git merge-file
, but it's kind of klunky.)
source to share