I am having a merge conflict when using git stash apply. How can I hard overwrite files using stash?
Something like that
git stash apply -Xours
I am having a merge conflict when using git stash apply. How can I hard overwrite files using stash?
Something like that
git stash apply -Xours
For the time being, git stash pop and git stash apply don't offer a way to automatically resolve conflicts.
From the documentation of git stash pop:
Applying the state can fail with conflicts; in this case, it is not removed from the stash list. You need to resolve the conflicts by hand and call
git stash dropmanually afterwards.
What you can do, however, is use git checkout to quickly resolve the conflicts by choosing one side.
Here's a bit from the Git Book:
The
git checkoutcommand can also take--oursand--theirsoptions, which can be a really fast way of just choosing either one side or the other without merging things at all.
In your case, you can simply run this after git stash apply:
git checkout --ours -- /path/to/conflicting/file