Skip to content

Instantly share code, notes, and snippets.

@mbaker3
Last active November 11, 2024 00:49
Show Gist options
  • Save mbaker3/a6617d8c42e9dcdaa11e0e83e490139c to your computer and use it in GitHub Desktop.
Save mbaker3/a6617d8c42e9dcdaa11e0e83e490139c to your computer and use it in GitHub Desktop.
Configure Git Console and Fork to use Rider for merge conflict diffs (UnityYAMLMerge)

Rider, with Unity integration, automatically runs UnityYAMLMerge on all YAML files when resolving merge conflicts. This may be preferrable to using a standalone solution that has no awareness of the larger project. If you're looking for a more generic solution that works for many diff tools check out mbaker3/UnityYAMLMerge.

General

Add the following to the .git/config of your repo. This will configure Rider to launch when you execute git mergetool or for any git clients that respect the config file.

[merge]
	tool = unityyamlmerge
[mergetool "unityyamlmerge"]
	trustExitCode = false
	cmd = /Applications/Rider.app/Contents/MacOS/rider merge "$LOCAL" "$REMOTE" "$BASE" "$MERGED"

Fork

  1. Open the menu item Fork -> Settings...
  2. Select the Integration tab.
  3. For the Merge Tool drop down select Custom.
  4. Press the Edit button next to the drop down.
  5. In the Edit Merge Tool dialog enter the following
    • File Path - /Applications/Rider.app/Contents/MacOS/rider
    • Arguments - merge $LOCAL $REMOTE $BASE $MERGED
  6. Click Edit to save your changes

When there is a merge conflict, select Merge in External Tool to open the diff in Rider and have it automatically run UnityYAMLMerge on the conflicts. If there are remaining conflicts they can be resolved manually in Rider's diff UI.

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