gpt4 book ai didi

git - 如何管理与 xlsx(二进制)的 Git merge 冲突?

转载 作者:太空狗 更新时间:2023-10-29 14:29:10 24 4
gpt4 key购买 nike

如何管理与 xlsx(二进制)的 Git merge 冲突?

它请求解决冲突:

$ 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.

我想获取文件的 origin/master 版本

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

它保留我的文件的本地版本。

如果我 checkout 文件,我会收到此错误:

$ git checkout labor_um/data/UM_specs.xlsx
error: path 'labor_um/data/UM_specs.xlsx' is unmerged

最佳答案

做:

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

checkout 命令的 --theirs 标志告诉 Git 使用你正在 merge 的分支的版本(在本例中为 origin/master)。同样,--ours 标志将使用您所在分支的版本(可能是 master)。

请注意 the definition of --theirs and --ours is swapped during a rebase .

关于git - 如何管理与 xlsx(二进制)的 Git merge 冲突?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39982702/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com