Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

While merging some of the files failed to merge.

git status

shows both the successful and failed merges.

How to view only the unsuccessful merge files(conflict).

Currently i am using the following command to do this

 find . -name '*.cpp' -o -name '*.h' | xargs grep -l '<<<<'
share|improve this question
up vote 15 down vote accepted
git diff

This will only show failed merges after an unsuccessful merge. It has many options to configure what information you want to see. I suspect this is the exact option you are after:

 git diff --name-status --diff-filter=U

Also see and

share|improve this answer
If you want a clean list of files without the preceding U, then you can call git diff --name-only --diff-filter=U. This way you can pipe the output, for example do git diff --name-only --diff-filter=U | xargs subl. – JHannes Oct 21 '15 at 12:21

Try this:

$ git ls-files -u
see man-git-ls-files
share|improve this answer
git --no-pager diff --name-only --diff-filter=U

But since the goal is most likely to edit those files, the following will do perfect:

git diff --name-only --diff-filter=U | xargs vim

Thanks to @JHannes from another answer's comment

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.