Friday, 11 June 2021

Using Meld for a 3-way merge

meld is available on Ubuntu via standard package manager:
 
$ sudo apt-get update && $ sudo apt-get install meld




There is a conflict in file test.txt on branch feature which we want to merge to dev.

$ git checkout dev
 
$ git merge feature
Auto-merging test.txt
CONFLICT (content): Merge conflict in test.txt
Automatic merge failed; fix conflicts and then commit the result.
 
$ git config merge.tool meld
 
$ git mergetool
Merging:
test.txt

Normal merge conflict for 'test.txt':
  {local}: modified file
  {remote}: modified file
test.txt seems unchanged.
Was the merge successful [y/n]? n
merge of test.txt failed
 
$ git status
On branch dev
Your branch is up-to-date with 'origin/dev'.

You have unmerged paths.
  (fix conflicts and run "git commit")
  (use "git merge --abort" to abort the merge)

...
Unmerged paths:
  (use "git add <file>..." to mark resolution)
    both modified:   test.txt
...