<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sect2 SYSTEM "../../../dtd/dblite.dtd">

<sect2 lang="en" id="git-mergetool&#45;&#45;lib(1)">
    <title>git-mergetool&#45;&#45;lib(1)</title>
    <date>2024-07-02</date>
<revhistory><revision><date>2024-07-02</date></revision></revhistory>
<indexterm>
<primary>git-mergetool&#45;&#45;lib(1)</primary>
</indexterm>
<simplesect id="git-mergetool&#45;&#45;lib(1)__name">
<title>NAME</title>
<simpara>git-mergetool--lib - Common Git merge tool shell scriptlets</simpara>
</simplesect>
<simplesect id="git-mergetool&#45;&#45;lib(1)__synopsis">
<title>SYNOPSIS</title>
<blockquote>
<literallayout><emphasis>TOOL_MODE=(diff|merge) . "$(git --exec-path)/git-mergetool&#45;&#45;lib"</emphasis></literallayout>
</blockquote>
</simplesect>
<simplesect id="git-mergetool&#45;&#45;lib(1)__description">
<title>DESCRIPTION</title>
<simpara>This is not a command the end user would want to run.  Ever.
This documentation is meant for people who are studying the
Porcelain-ish scripts and/or are writing new ones.</simpara>
<simpara>The <emphasis>git-mergetool&#45;&#45;lib</emphasis> scriptlet is designed to be sourced (using
<emphasis>.</emphasis>) by other shell scripts to set up functions for working
with Git merge tools.</simpara>
<simpara>Before sourcing <emphasis>git-mergetool&#45;&#45;lib</emphasis>, your script must set <emphasis>TOOL_MODE</emphasis>
to define the operation mode for the functions listed below.
<emphasis>diff</emphasis> and <emphasis>merge</emphasis> are valid values.</simpara>
</simplesect>
<simplesect id="git-mergetool&#45;&#45;lib(1)__functions">
<title>FUNCTIONS</title>
<variablelist>
<varlistentry>
<term>
get_merge_tool
</term>
<listitem>
<simpara>
        Returns a merge tool. The return code is 1 if we returned a guessed
        merge tool, else 0. <emphasis>$GIT_MERGETOOL_GUI</emphasis> may be set to <emphasis>true</emphasis> to
        search for the appropriate guitool.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
get_merge_tool_cmd
</term>
<listitem>
<simpara>
        Returns the custom command for a merge tool.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
get_merge_tool_path
</term>
<listitem>
<simpara>
        Returns the custom path for a merge tool.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
initialize_merge_tool
</term>
<listitem>
<simpara>
        Brings merge tool specific functions into scope so they can be used or
        overridden.
</simpara>
</listitem>
</varlistentry>
<varlistentry>
<term>
run_merge_tool
</term>
<listitem>
<simpara>
        Launches a merge tool given the tool name and a true/false
        flag to indicate whether a merge base is present.
        <emphasis>$MERGED</emphasis>, <emphasis>$LOCAL</emphasis>, <emphasis>$REMOTE</emphasis>, and <emphasis>$BASE</emphasis> must be defined
        for use by the merge tool.
</simpara>
</listitem>
</varlistentry>
</variablelist>
</simplesect>
<simplesect id="git-mergetool&#45;&#45;lib(1)__git">
<title>GIT</title>
<simpara>Part of the <xref linkend="git(1)" /> suite</simpara>
</simplesect>
</sect2>
