Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 743
inger Avatar asked Jun 17 '10 21:06

inger


People also ask

How do I see conflicts in Git?

Git can handle most merges on its own with automatic merging features. A conflict arises when two separate branches have made edits to the same line in a file, or when a file has been deleted in one branch but edited in the other. Conflicts will most likely happen when working in a team environment.

Which command in Git can be used to see files in merge conflict?

To see the beginning of the merge conflict in your file, search the file for the conflict marker <<<<<<< . When you open the file in your text editor, you'll see the changes from the HEAD or base branch after the line <<<<<<< HEAD .


1 Answers

Use git diff, with name-only to show only the names, and diff-filter=U to only include 'Unmerged' files.

git diff --name-only --diff-filter=U 
like image 115
CB Bailey Avatar answered Sep 21 '22 19:09

CB Bailey