Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manage a Git merge conflict with xlsx (binary)?

Tags:

git

git-merge

How to manage a Git merge conflict with xlsx (binary)?

It requested to fix the conflict:

$ git merge  
warning: Cannot merge binary files: proj/data/specs.xlsx (HEAD vs. 
refs/remotes/origin/master)
Auto-merging proj/data/specs.xlsx
CONFLICT (content): Merge conflict in proj/data/specs.xlsx
Automatic merge failed; fix conflicts and then commit the result.

I want get the origin/master version of the file

git add proj/data/specs.xlsx; git commit

it keep my local version of the file.

If I checkout the file I get this error:

$ git checkout labor_um/data/UM_specs.xlsx
error: path 'labor_um/data/UM_specs.xlsx' is unmerged
like image 397
user3313834 Avatar asked Oct 22 '25 04:10

user3313834


1 Answers

Do:

git checkout --theirs proj/data/specs.xlsx
git add proj/data/specs.xlsx
git commit

The --theirs flag for the checkout command tells Git to use the version from the branch you are merging (in this case origin/master). Similarly, the --ours flag would use the version from the branch you are on (likely master).

Note that the definition of --theirs and --ours is swapped during a rebase.

like image 79
Scott Weldon Avatar answered Oct 25 '25 01:10

Scott Weldon