After some operation that produces merge conflicts, we can do this:
$ git checkout
foo/bar/x.c: needs merge
foo/bar/y.c: needs merge
xyzzy/w.c: needs merge
Using nothing but some git
command, how can we just get this output:
foo/bar/x.c
foo/bar/y.c
xyzzy/w.c
git status
shows the files as both modified:
, and using the git status -s
format they show up in the output as:
UU foo/bar/x.c
UU foo/bar/y.c
UU xyzzy/w.c
so that doesn't meet the requirements. git checkout
doesn't take anything resembling --name-only
. git diff --name-only
lists nothing but the files, but also includes files that do not have conflicts.
I want to avoid the anti-pattern of textually processing the output of git "porcelain" commands, which I obviously know how to do:
git status -s | awk '$1=="UU"&&$0=$2'
Therefore, I will spitefully retaliate against all answers in this vein by flagging and whatnot. Don't say you weren't warned.