相关疑难解决方法(0)

获取冲突文件列表的最简单方法是什么?

我只需要一个冲突文件的简单列表.

有什么比这简单:

git ls-files -u  | cut -f 2 | sort -u
Run Code Online (Sandbox Code Playgroud)

要么

git ls-files -u  | awk '{print $4}' | sort | uniq
Run Code Online (Sandbox Code Playgroud)

我想我可以为此设置一个方便的别名,但是想知道专业人士是如何做到的.我用它来编写shell循环,例如自动解决冲突等.也许通过插入mergetool.cmd替换该循环?

git git-merge git-merge-conflict

641
推荐指数
10
解决办法
31万
查看次数

31
推荐指数
3
解决办法
11万
查看次数

shell - temp IFS仅作为换行符.为什么这不起作用:IFS = $(echo -e'\n')

我正在尝试for在shell中使用空格迭代文件名.我在读计算器的问题IFS=$'\n'可以被使用,这似乎很好地工作.然后,在评论中读到一个答案,使其与除了可以使用的bash之外的shell兼容IFS=$(echo -e '\n').

前者有效,后者无效.该评论被多次上调.我检查了输出,变量似乎不包含换行符.

#!/bin/sh

IFS=$(echo -e '\n')
echo -n "$IFS" | od -t x1
for file in `printf 'one\ntwo two\nthree'`; do
    echo "Found $file"
done

echo

IFS=$'\n'
echo -n "$IFS" | od -t x1
for file in `printf 'one\ntwo two\nthree'`; do
    echo "Found $file"
done
Run Code Online (Sandbox Code Playgroud)


输出显示第一个字段分隔符丢失:

0000000
Found one
two two
three
Run Code Online (Sandbox Code Playgroud)


但是第二个是正确的:

0000000 0a
0000001
Found one
Found two two
Found three
Run Code Online (Sandbox Code Playgroud)


我找到了一个已回答的问题,可能与我的问题重复或不同:
linux …

bash shell ifs

6
推荐指数
2
解决办法
2万
查看次数

标签 统计

bash ×2

git ×1

git-merge ×1

git-merge-conflict ×1

ifs ×1

shell ×1