The Computer Oracle

How to view only the unmerged files in git after a merge failure

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Droplet of life

--

Chapters
00:00 How To View Only The Unmerged Files In Git After A Merge Failure
00:31 Accepted Answer Score 64
00:59 Answer 2 Score 13
01:08 Answer 3 Score 13
01:32 Thank you

--

Full question
https://superuser.com/questions/321310/h...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#git

#avk47



ACCEPTED ANSWER

Score 64


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 http://www.kernel.org/pub/software/scm/git/docs/user-manual.html#resolving-a-merge and http://www.kernel.org/pub/software/scm/git/docs/git-diff.html




ANSWER 2

Score 13


Try this:

$ git ls-files -u
see man-git-ls-files



ANSWER 3

Score 13


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

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

vim $(git diff --name-only --diff-filter=U)

Or in Windows with VS Code:

foreach($file in $(git --no-pager diff --name-only --diff-filter=U)){code.cmd $file --wait}

Thanks to @JHannes comment from another answer for inspiration