ish*_*ood 26 git git-add git-checkout
说我在尝试合并后进入时有这个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
Run Code Online (Sandbox Code Playgroud)
...而且我知道我想为每个文件执行此操作:
git checkout --theirs myfile1.xhtml
git add myfile1.xhtml
Run Code Online (Sandbox Code Playgroud)
......但其中有很多.我怎么能批量做?
ish*_*ood 27
我的案例的解决方案最终只是在目录路径中使用通配符,因为文件是分组的:
git checkout --theirs directory_name/*
git add directory_name/*
Run Code Online (Sandbox Code Playgroud)
小智 7
您可以使用以下命令在未合并路径上检出多个文件
git checkout --theirs `git status | grep "added by them:" | awk '{print $NF}'`
Run Code Online (Sandbox Code Playgroud)
执行下面的命令来提交上面的文件
git commit `git status | grep "added by them:" | awk '{print $NF}'`
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
20973 次 |
| 最近记录: |