Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hrishimittal/4754b7d5a5c5ad68c673ba5562573a73 to your computer and use it in GitHub Desktop.
Save hrishimittal/4754b7d5a5c5ad68c673ba5562573a73 to your computer and use it in GitHub Desktop.
Open all files with git merge conflicts in Vim

Open all files with git merge conflicts in MacVim

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

When git encounters a merge conflict, e.g. during a rebase, it drops you back into the shell with a dirty working directory. I like this one-liner for opening all files with a merge conflict in MacVim.

Once you're in Vim, you can then switch between the files with :n and :prev, or another favourite: :w | n (save current file and open the next command line-supplied file).

UPDATE: see below for a version that works with real terminal commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment