Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

libgit2sharp equivalent of "git mergetool"

I want to use the equivalent of "git mergetool" within libgit2sharp. Is there a sample to do this? Or do I have to dive deep and try to implement this in libgit2sharp?

The call "git mergetool" checks if merge is required and calls the custom mergetool with a copy of the server. A proper way to call the mergetool would be usefull. I know I can read the config and search the mergetool and its "cmd" command.

Greetings Thomas

like image 234
SoftwareArchitec Avatar asked May 03 '26 05:05

SoftwareArchitec


1 Answers

LibGit2Sharp is used to programmatically interact with a git repository. It won't launch a mergetool directly.

However, you can use LibGit2Sharp to retrieve the configuration values from a given repository. For instance, by using:

var mergeTool = repo.Config.Get<string>("merge.tool").Value;
var path = repo.Config.Get<string>("mergetool." + mergeTool + ".path").Value;

You can retrieve the path of the configured merge tool.

like image 78
yorah Avatar answered May 05 '26 18:05

yorah