LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

git-merge-file

Three-way file merging

TLDR

Three-way merge files
$ git merge-file [current] [base] [other]
copy
Merge with diff3 style
$ git merge-file --diff3 [current] [base] [other]
copy
Output to stdout
$ git merge-file -p [current] [base] [other]
copy
Quiet mode
$ git merge-file -q [current] [base] [other]
copy

SYNOPSIS

git merge-file [options] current base other

DESCRIPTION

git merge-file performs a three-way merge on individual files. Given the current version, common ancestor, and other version, it produces a merged result with conflict markers where automatic resolution is not possible.The command operates on files outside of Git's normal merge workflow, making it useful for custom merge scenarios or merging files independently. The first file is modified in place with the merge result, and the exit code indicates whether conflicts occurred.

PARAMETERS

CURRENT

Current version file.
BASE
Common ancestor file.
OTHER
Other version to merge.
-p, --stdout
Output to stdout.
--diff3
Include base in conflicts.
-q, --quiet
Suppress warnings.
--ours
Resolve conflicts in favor of the "current" version.
--theirs
Resolve conflicts in favor of the "other" version.
--union
Take both sides of each conflict (append rather than mark).
-L label
Provide a label for a file (pass up to three times for current/base/other).
--help
Display help information.

INSTALL

sudo apt install git
copy
sudo dnf install git
copy
sudo pacman -S git
copy
sudo apk add git
copy
sudo zypper install git
copy
brew install git
copy
nix profile install nixpkgs#git
copy

CAVEATS

Plumbing command. Modifies first file in place. Exit code indicates conflicts.

HISTORY

git merge-file is a core Git plumbing command implementing the three-way merge algorithm used internally by git merge.

SEE ALSO

git-merge(1), diff3(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid