-1

例如:

$ git status
On branch master
You have unmerged paths.
  (fix conflicts and run "git commit")
  (use "git merge --abort" to abort the merge)

Unmerged paths:
  (use "git add <file>..." to mark resolution)

    both modified:   test.txt
$ git ls-files
test.txt
test.txt
test.txt

有没有办法让它也只列出一次这种类型的文件?我只需要文件名。

4

2 回答 2

2

当发生冲突时,就会发生这种情况。它们中的每一个都是文件的不同版本。检查:

git ls-files -s

看一下git help read-tree,关于3-way merge的部分。对您来说重要的部分是:...and you will end up with an index with all of the <tree1> entries in "stage1", all of the <tree2> entries in "stage2" and all of the <tree3> entries in "stage3". When performing a merge of another branch into the current branch, we use the common ancestor tree as <tree1>, the current branch head as <tree2>, and the other branch head as <tree3>

于 2020-05-19T22:18:32.707 回答
1

有没有办法让它也只列出一次这种类型的文件?

git ls-files | sort -u

Git 倾向于不复制现有工具。

于 2020-05-20T00:03:00.747 回答