Tell git not to merge binary files but to choose
And then, I branch to a temporary branch, and commit the local changed binary files, and merge them back after the pull with recursive theirs strategy. — Too much work.
- What's the difference between git merge --no-ff and git merge --squash
- Github Desktop doesn't display commits from merge --no-ff
- How can Jenkins list merge request titles from Gitlab in build report
- git: How do I add a custom merge strategy?
- How to merge/pull from remote repository
- How to git-merge two diverged branches side-by-side into one branch?
Is there a way to tell git, not to attempt merging binary files and ask me which one of these versions to use.
One Solution collect form web for “Tell git not to merge binary files but to choose”
You could set up a merge drive in a
.gitattributes file (only for a given subtree, only for some file types)
See this question for instance (or this one).
# choose the name of the merge driver to be use for all jar files echo *.jar merge=keepTheir > dirWithJarFiles\.gitattributes
Declare your merge driver in the config of the Git repo:
git config merge.keepTheir.name "always keep their during merge" git config merge.keepTheir.driver "keepTheir.sh %O %A %B"
git config merge.keepMine.name "always keep mine during merge" git config merge.keepMine.driver "keepMine.sh %O %A %B" [merge "keepMine"] name = always keep mine during merge driver = keepMine.sh %O %A %B
The example I give don’t ask you for a choice but will always keep “mine” (or “yours”) version when merging.
But you could adapt the script executed by this merge driver to ask you a question, and then apply your choice to all merges.