9

So I am trying to rebase and get conflicts. The git rebase command does list them, but is there any way for me to see the list of conflicts later with a separate git command, without continuing or skipping the rebase?

(I am writing a script to automate rebasing in favor of one branch or the other, without having to fire up an editor for every file. But grepping through the entire repo for >>>>>> and <<<<<< is rather time-consuming so I'd rather access the list directly)

Mikhail Ramendik
  • 1,063
  • 2
  • 12
  • 26
  • 2
    Would `git status` do? – Biffen Jun 01 '18 at 17:02
  • `git diff` does the job. Pass `-U0` flag to discard the text around the hunks. – bimlas Jun 01 '18 at 17:07
  • https://git-scm.com/docs/git-diff - search for `theirs`. (Sorry, I'm on Android and I hate typing on it) – bimlas Jun 01 '18 at 17:11
  • 2
    Possible duplicate of [What's the simplest way to get a list of conflicted files?](https://stackoverflow.com/questions/3065650/whats-the-simplest-way-to-get-a-list-of-conflicted-files) – phd Jun 01 '18 at 20:04

2 Answers2

8

Try with: git diff --name-only --diff-filter=U

It should give you a plain list of the unmerged paths, like:

path/to/file

… whereas git status would show this:

Unmerged paths:
  (use "git add <file>..." to mark resolution)
        both modified:   path/to/file
CodeManX
  • 11,159
  • 5
  • 49
  • 70
estevanj
  • 111
  • 4
1

This one usually what I use. git ls-files -u

Marko
  • 83
  • 1
  • 7