如何为多个文件(或所有未合并的文件)执行“git checkout --theirs” [英] How to do 'git checkout --theirs' for multiple files (or all unmerged files)

查看:2157
本文介绍了如何为多个文件(或所有未合并的文件)执行“git checkout --theirs”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

假设我在尝试合并后并输入了 git status

Say I have this after attempting a merge and upon entering git status:

# Unmerged paths:
#   (use "git add/rm <file>..." as appropriate to mark resolution)
#
#   added by them: myfile1.xhtml
#   added by them: myfile2.xhtml
#   added by them: myfile3.xhtml

...我知道我想为每个文件做这件事:

... and I know I want to do this for each of those files:

git checkout --theirs myfile1.xhtml
git add myfile1.xhtml

...但其中有很多。我怎样才能将它们作为批处理?

... but there are many of them. How might I do them as a batch?

推荐答案

我的解决方案最终只是在目录中使用通配符路径,因为这些文件是分组的:

The solution for my case ended up being to simply use a wildcard in the directory path, since the files were grouped:

git checkout --theirs directory_name/*
git add directory_name/*

这篇关于如何为多个文件(或所有未合并的文件)执行“git checkout --theirs”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆