# GIT-MERGETOOL--LIB - Common Git merge tool shell scriptlets - man(1) - [phpMan]


*Source: tldr-pages*

---

[_GIT-MERGETOOL--LIB_(1)](https://www.chedong.com/phpMan.php/man/GIT-MERGETOOL--LIB/1/markdown)                        Git Manual                        [_GIT-MERGETOOL--LIB_(1)](https://www.chedong.com/phpMan.php/man/GIT-MERGETOOL--LIB/1/markdown)

## NAME
       git-mergetool--lib - Common Git merge tool shell scriptlets

## SYNOPSIS
       _TOOL_MODE=(diff|merge)_ _._ _"$(git_ _--exec-path)/git-mergetool--lib"_


## DESCRIPTION
       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.

       The _git-mergetool--lib_ scriptlet is designed to be sourced (using **.**) by other shell scripts
       to set up functions for working with Git merge tools.

       Before sourcing _git-mergetool--lib_, your script must set **TOOL_MODE **to define the operation
       mode for the functions listed below. _diff_ and _merge_ are valid values.

## FUNCTIONS
       get_merge_tool
           Returns a merge tool. The return code is 1 if we returned a guessed merge tool, else 0.
           _$GIT_MERGETOOL_GUI_ may be set to _true_ to search for the appropriate guitool.

       get_merge_tool_cmd
           Returns the custom command for a merge tool.

       get_merge_tool_path
           Returns the custom path for a merge tool.

       initialize_merge_tool
           Brings merge tool specific functions into scope so they can be used or overridden.

       run_merge_tool
           Launches a merge tool given the tool name and a true/false flag to indicate whether a
           merge base is present.  _$MERGED_, _$LOCAL_, _$REMOTE_, and _$BASE_ must be defined for use by
           the merge tool.

## GIT
       Part of the [**git**(1)](https://www.chedong.com/phpMan.php/man/git/1/markdown) suite

Git 2.43.0                                   07/02/2025                        [_GIT-MERGETOOL--LIB_(1)](https://www.chedong.com/phpMan.php/man/GIT-MERGETOOL--LIB/1/markdown)
