What's the simplest way to list conflicted files in Git?

Question

I just need a plain list of conflicted files.

Is there anything simpler than:

git ls-files -u  | cut -f 2 | sort -u

or:

git ls-files -u  | awk '{print $4}' | sort | uniq

I guess I could set up a handy alias for that, however was wondering how pros do it. I'd use it to write shell loops e.g. to auto-resolve conflict, etc. Maybe replace that loop by plugging into mergetool.cmd?

Answer

Use git diff, with name-only to show only the names, and diff-filter=U to only include 'Unmerged' files (optionally, relative to show paths relative to current working directory) .

git diff --name-only --diff-filter=U --relative

Warning: push.default is unset; its implicit value is changing in Git 2.0

Handling file renames in Git