{"id":13479765,"url":"https://github.com/whiteinge/diffconflicts","last_synced_at":"2025-04-05T12:06:18.886Z","repository":{"id":33599780,"uuid":"141395505","full_name":"whiteinge/diffconflicts","owner":"whiteinge","description":"A better Vimdiff Git mergetool","archived":false,"fork":false,"pushed_at":"2024-01-30T15:39:25.000Z","size":746,"stargazers_count":410,"open_issues_count":2,"forks_count":20,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-03-29T11:08:45.699Z","etag":null,"topics":["git","mergetool","vim","vim-plugin","vimdiff"],"latest_commit_sha":null,"homepage":null,"language":"Vim Script","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/whiteinge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-07-18T07:08:40.000Z","updated_at":"2025-03-25T10:58:42.000Z","dependencies_parsed_at":"2024-10-26T21:20:29.687Z","dependency_job_id":"2e9fa229-7ab1-4585-9817-736d47531e31","html_url":"https://github.com/whiteinge/diffconflicts","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whiteinge%2Fdiffconflicts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whiteinge%2Fdiffconflicts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whiteinge%2Fdiffconflicts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/whiteinge%2Fdiffconflicts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/whiteinge","download_url":"https://codeload.github.com/whiteinge/diffconflicts/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247332604,"owners_count":20921853,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["git","mergetool","vim","vim-plugin","vimdiff"],"created_at":"2024-07-31T16:02:22.617Z","updated_at":"2025-04-05T12:06:18.862Z","avatar_url":"https://github.com/whiteinge.png","language":"Vim Script","readme":"# vim-diffconflicts\n\nA better Vimdiff mergetool.\n\ntl;dr:\n\n* Call `:DiffConflicts` to convert a file containing conflict markers into\n  a two-way diff.\n* Install as a Git or Mercurial mergetool to do that automatically. (See\n  [Installation](#installation) below.)\n\n## Why?\n\nWatch a demonstration version of this README on YouTube:\n\n[![diffconflicts Video Demonstration](https://img.youtube.com/vi/Pxgl3Wtf78Y/0.jpg)](https://www.youtube.com/watch?v=Pxgl3Wtf78Y)\n\nContents:\n\n* [Three-Way Diffs are Hard](#three-way-diffs-are-hard)\n* [Editing-Conflict-Markers-is-Hard](#editing-conflict-markers-is-hard)\n* [Two-Way Diffs are Eas(ier)](#two-way-diffs-are-easier)\n* [Conflict-Markers **are** a Two-Way Diff](#conflict-markers-are-a-two-way-diff)\n\n### Three-Way Diffs are Hard\n\nWhen Git cannot automatically resolve conflicts it writes a file with conflict\nmarkers surrounding the conflicting areas. These conflicts must be resolved\nmanually. This is often done via a three-way comparison.\n\nVim supports three-way diffs however syntax highlighting alone is not\nsufficient to showcase the differences between that many versions. In addition,\nthe default keybindings are not well suited to moving individual changes\nbetween that many windows.\n\nThe screenshot below is an example of Vimdiff as a Git mergetool using default\nsettings. None of the conflicts have an obvious resolution:\n\n![](./_utils/default-vimdiff.png)\n\n### Editing Conflict Markers is Hard\n\nWhen human intervention is needed it is rarely as simple as choosing the \"left\"\nchange or the \"right\" change. The correct resolution often involves a mix of\nboth changes. It is difficult to manually edit a file containing Git conflict\nmarkers because the human eye isn't well suited to spotting subtle differences,\nparticularly when the differences are not adjacent:\n\n![](./_utils/conflict-markers.png)\n\n### Two-Way Diffs are Eas(ier)\n\nA two-way diff more simply highlights just the relevant differences which makes\nthe resolution more clear. The merge base and history of each version of the\nconflict is a useful reference to learn the intent of each conflicting change,\nhowever those are not as useful to see in the diff.\n\nVimdiff is well suited to two-way diffs:\n\n![](./_utils/vim-diffconflicts.png)\n\n### Conflict-Markers **are** a Two-Way Diff\n\nGit does an admirable job of automatically resolving conflicts. We want to\nretain all the work and resolve only the things that Git could not. That work\n_**is**_ reflected in the files containing conflict markers, but it _**is\nnot**_ reflected in a two-way diff between LOCAL and REMOTE.\n\nRather than editing the conflict markers directly, it is better to perform\na two-way diff on _**only**_ the \"left\" and \"right\" sides of the conflict\nmarkers by splitting them apart.\n\n## Installation\n\n1.  Install this plugin using your favorite Vim plugin manager, or just clone\n    the repo into your packages directory (see `:help packages`).\n\n2.  Configure Git to use this plugin as a mergetool:\n\n    ```\n    git config --global merge.tool diffconflicts\n    git config --global mergetool.diffconflicts.cmd 'vim -c DiffConflicts \"$MERGED\" \"$BASE\" \"$LOCAL\" \"$REMOTE\"'\n    git config --global mergetool.diffconflicts.trustExitCode true\n    git config --global mergetool.keepBackup false\n    ```\n\n    Or, if you'd prefer to always open both the diff view and the history view\n    call `DiffConflictsWithHistory` instead:\n\n    ```\n    git config --global mergetool.diffconflicts.cmd 'vim -c DiffConflictsWithHistory \"$MERGED\" \"$BASE\" \"$LOCAL\" \"$REMOTE\"'\n    ```\n\n3.  During a merge you can call `:DiffConflictsShowHistory` to open a new tab\n    containing the merge BASE and full copies of the LOCAL and REMOTE versions\n    of the conflicted file. This can help to understand the history or intent\n    behind the conflicting changes to help you decide how best to combine the\n    changes.\n\n    This tab is not opened by default so that Vim starts more quickly.\n\n\n## Mercurial\n\nConfigure Mercurial to use diffconflicts as a mergetool by adding:\n\n    [merge-tools]\n    diffconflicts.executable=vim\n    diffconflicts.args=-c 'let g:diffconflicts_vcs=\"hg\"' -c DiffConflicts \"$output\" $base $local $other\n    diffconflicts.premerge=keep\n    diffconflicts.check=conflicts\n    diffconflicts.priority=99\n\nto your `.hgrc` file.\nOr, if you prefer to always open both the diff view and the history view use\n\n    diffconflicts.args=-c 'let g:diffconflicts_vcs=\"hg\"' -c DiffConflictsWithHistory \"$output\" $base $local $other\n\nas the args setting to call `DiffConflictsWithHistory`.\n","funding_links":[],"categories":["Vim Script"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhiteinge%2Fdiffconflicts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwhiteinge%2Fdiffconflicts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwhiteinge%2Fdiffconflicts/lists"}