Last Updated: October 25, 2018
· ugorelik

Open all files with merge conflicts (with Sublime)

git diff --name-only | uniq | xargs subl

I found it useful to create an alias too:

git config --global alias.cf '!sh -c "git diff --name-only | uniq | xargs subl"'

And of course you can substitute subl for your favorite editor.

4 Responses
Add your response


This is odd. I am getting:
git diff --name-only | uniq | xargs subl
xargs: subl: No such file or directory

but then when I do which subl, it says:
subl: aliased to '/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl'

Any help is appreciated.

over 1 year ago ·

Maybe you need to do a symbolic link on sublime: https://www.sublimetext.com/docs/2/osx_command_line.html

over 1 year ago ·

It also really helps to add -n after subl if you want the merge conflicts to open in a new sublime window. If you are currently working on many files (including the ones with merge conflicts), using -n ensures you will see ONLY the files with merge conflicts in this new window.

over 1 year ago ·

Its works for me on Ubuntu :D


over 1 year ago ·