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

List filenames of files with merge conflicts

This command helps you identify which files currently have merge conflicts by listing only their filenames.

It uses git diff with --name-only to output just the paths of changed files and --diff-filter=U to restrict results to those with a merge-conflict status (U), showing exactly which files need resolution without displaying the actual diff content.

For more detail, you can use --name-status instead of --name-only to include conflict status letters, or omit it entirely to view full conflict hunks. You can also add --cached to inspect staged conflicts. Related commands include git ls-files -u for listing unmerged files with stage info and git status --porcelain to see an overview of conflicted files.

Related commands

Welcome to GitExamples!

Sign in to enable bookmarking, reminders, progress-tracking and more...