如何管理 Git 与 xlsx(二进制)的合并冲突?
How to manage a Git merge conflict with xlsx (binary)?
如何管理 Git 与 xlsx(二进制)的合并冲突?
它请求解决冲突:
$ 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
它保留了我本地版本的文件。
如果我签出文件,我会收到此错误:
$ 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
应该采用 origin
上 xlsx
文件的版本并忽略您修改的版本。
它应该可以解决冲突,然后您需要提交它。
做:
git checkout --theirs proj/data/specs.xlsx
git add proj/data/specs.xlsx
git commit
checkout
命令的 --theirs
标志告诉 Git 使用来自您正在合并的分支的版本(在本例中为 origin/master
)。同样,--ours
标志将使用您所在分支的版本(可能 master
)。
注意 the definition of --theirs
and --ours
is swapped during a rebase
.
如何管理 Git 与 xlsx(二进制)的合并冲突?
它请求解决冲突:
$ 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
它保留了我本地版本的文件。
如果我签出文件,我会收到此错误:
$ 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
应该采用 origin
上 xlsx
文件的版本并忽略您修改的版本。
它应该可以解决冲突,然后您需要提交它。
做:
git checkout --theirs proj/data/specs.xlsx
git add proj/data/specs.xlsx
git commit
checkout
命令的 --theirs
标志告诉 Git 使用来自您正在合并的分支的版本(在本例中为 origin/master
)。同样,--ours
标志将使用您所在分支的版本(可能 master
)。
注意 the definition of --theirs
and --ours
is swapped during a rebase
.