English 中文(简体)
• 如何进行盘点检查——多份档案的继承人(或所有未合并的档案)
原标题:How to do git checkout --theirs for multiple files (or all unmerged files)

Saye 我在尝试合并后,并在加入<条码>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

......我知道,我想要为这些档案中的每一份提供:

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

......但其中有许多。 我怎么会把他们当作一种施舍?

最佳回答

我的案件解决办法最终是简单地在名录路上使用野心,因为档案被归类为:

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

根据,:

git checkout --theirs directory_name/.
问题回答

你们可以使用以下指挥系统,检查关于未合并道路的多个档案。

git checkout --theirs `git status | grep "added by them:" | awk  {print $NF} `

执行以下指挥系统以实施上述档案

git commit `git status | grep "added by them:" | awk  {print $NF} `

If your files are deeper than one directory (ie. there are subdirectories) and you want to selectively recursively choose all their files for a directory, then use the following:

grep -lr  <<<<<<<  directory_name/ | xargs git checkout --theirs
git add directory_name/*

(从>, 网页)

检查所有未合并的档案,但没有具体说明目录:

git ls-files --unmerged | perl -n -e /	(.*)/ && print "$1
"  | uniq | xargs -r git checkout --theirs --

https://snipt.net/binjured/git-checkout-theirs-for-all-unjointd/"rel=“nofollow”>

这一简单的解决办法对我来说是有效的,因此,如果把项目称作src,你可以补充所有内容。”

git checkout --theirs src/*




相关问题
git confusion - cloning a repo is returning a past version

Im having some confusion with my git usage. I cloned a repo from one comp to the other, and the new clone is the state of the original that was active some time ago. So its cloning a past version. ...

Appropriate strategy for tagging and hotfixing with git

I was wondering if the strategy I m using for tagging and hotfixing tags (which then I use for deploying rails applications) with git is appropriate. For tagging I just tag a commit of the master ...

Tips on upgrading CVS to git/hg?

We still use CVS, I use git and hg for my personal use though I m still a novice at both, but I realize they re much more modern and better, faster, distributed, etc. It s just everyone is so ...

Using Git in a TFS shop

Using Git at home has spoiled me - I now find using TFS at work to be a bit of a drag and want to explore the possibility of using Git locally and syncing somehow with TFS. I figure there are a few ...

热门标签