GIT-MERGETOOL--LIB(1)

πŸ’… git-mergetool--lib(1) β€” the Git Manual, but make it make sense

okay so bestie, welcome to the git-mergetool--lib page of the Git Manual. buckle up, this one's a little niche but she's iconic in her own way πŸŽ€


✨ NAME ✨

git-mergetool--lib β€” common Git merge tool shell scriptlets 🐚


🌸 SYNOPSIS 🌸

TOOL_MODE=(diff|merge) . "$(git --exec-path)/git-mergetool--lib"

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so real talk: this is not a command the end user would want to run. ever. like, ever-ever πŸ’€ this documentation is meant for people who are studying the Porcelain-ish scripts and/or are writing new ones. it's giving backstage pass energy, not main character energy.

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. she's a supporting actress, and she ate 🫢

⚠️ 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. no TOOL_MODE, no vibes. periodt.

πŸ‘‘ 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. lowkey the glow-up function of the group ngl.

πŸ’– 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. like, all four, bestie β€” no skipping πŸ™ˆ


🌈 GIT 🌈

part of the git(1) suite ⭐


and that's the whole page, bestie! this one's from Git 2.56.0, dated 2026-09-27 β€” go forth and source responsibly πŸ’œπŸ¦‹

πŸ“¦ where this page comes from