WARNING: This tool is still experimental.
merge-fmt
is a small wrapper on top git commands to help resolve conflicts by leveraging
code formatters.
merge-fmt
currently only knows about the following formatters:
- ocamlformat for OCaml.
- refmt for reason.
- dune for dune.
Note that supporting new code formatters is trivial.
There are three ways to use merge-fmt.
Just call merge-fmt
while there are unresolved conflicts. merge-fmt
will try
resolve conflicts automatically.
merge-fmt
can act as a git mergetool.
First configure the current git repository with
merge-fmt setup-mergetool
git config --local mergetool.mergefmt.cmd 'merge-fmt mergetool --base=$BASE --current=$LOCAL --other=$REMOTE -o $MERGED'
git config --local mergetool.mergefmt.trustExitCode true
Then, use git mergetool
to resolve conflicts with
git mergetool -t mergefmt
merge-fmt
can act as a git merge driver.
Configure the current git repository to use merge-fmt as the default merge driver.
$ merge-fmt setup-merge
git config --local merge.mergefmt.name 'merge-fmt driver'
git config --local merge.mergefmt.driver 'merge-fmt mergetool --base=%O --current=%A --other=%B -o %A --name=%P'
git config --local merge.tool 'mergefmt'
git config --local merge.default 'mergefmt'
$ opam pin add merge-fmt [email protected]:hhugo/merge-fmt.git