Strumenti Utente

Strumenti Sito


mergetooltool

Download the script mergetooltool.py.

What is this

This script does something very simple, but for which I did not find a ready solution: use the ability of git to solve conflicts in merges, while providing an intuitive graphic interface.

How it works

  1. You just did a “git merge”, or “git rebase -i”, and git tells you there is a conflict for file “conflicted.txt”. When it tells you, it has already put some markers in “conflicted.txt” to distinguish the two different versions.
  2. You then call “/path/to/mergetooltool.py conflicted.txt”: it parses “conflicted.txt”, recognizes the markers, and simply creates two separate files, one with each version. Then, it opens your favorite diff GUI (I use meld, you can simply set yours at line 9 of the script), lets you resolve conflicts (the version you want to use should be left in the left pane, the one showing “filename.local”), and when you close puts the merged version back at “conflicted.txt”.
  3. You can then do “git add conflicted.txt” and (if you don't have other conflicted files) “git commit”, and you're done.
mergetooltool.txt · Ultima modifica: 2014/01/23 08:32 da pietro