Skip to content

Fix gitconfig: Incorrect merge.tool setting and redundant mergetool configs #45

@chicham

Description

@chicham

Problem

The gitconfig template incorrectly configures mergiraf as a mergetool when it should only be a merge driver.

Issues:

  1. Line 129: Incorrect merge.tool setting

    • Currently set to merge.tool = mergiraf
    • Mergiraf is a merge driver (automatic), NOT a mergetool (interactive)
    • No [mergetool "mergiraf"] section exists, causing fallback to nvim unexpectedly
  2. Redundant mergetools

    • Both nvim (line 135) and fugitive (line 139) are configured
    • Fugitive is a vim plugin, making it redundant with nvim
    • Both have aliases (lines 206, 208)

Current Configuration (dot_gitconfig.tmpl)

# Lines 117-119: CORRECT - Merge driver for automatic conflict resolution
[merge "mergiraf"]
    name = mergiraf
    driver = mergiraf merge --git %O %A %B -s %S -x %X -y %Y -p %P -l %L

# Line 129: INCORRECT - mergiraf is not a mergetool!
[merge]
    tool = mergiraf

# Lines 135-142: Redundant tools
[mergetool "nvim"]
    cmd = nvim -d "$LOCAL" "$REMOTE" "$MERGED" -c 'wincmd J | wincmd ='

[mergetool "fugitive"]
    cmd = nvim -f -c \"Gvdiffsplit!\" \"$MERGED\"

Expected Behavior

According to mergiraf docs:

  • Mergiraf should be registered as a merge driver (already correct)
  • When mergiraf cannot auto-resolve, git should leave conflict markers
  • Users manually invoke a mergetool if needed (e.g., git nvimmerge)

Proposed Solution

dot_gitconfig.tmpl changes:

  1. Remove or change merge.tool setting (line 129):

    [merge]
        log = true
        conflictstyle = diff3
        ff = only
        # tool = mergiraf  # REMOVE - mergiraf is a driver, not a tool
  2. Remove fugitive (redundant):

    • Delete lines 139-142: [mergetool "fugitive"]
    • Delete line 208: fugmerge alias
  3. Optional: Set default mergetool to nvim:

    [merge]
        tool = nvim  # Explicit fallback for manual conflict resolution

Also verify gitattributes:

  • Ensure ~/.gitattributes_global or .git/info/attributes has:
    * merge=mergiraf
    
    Or specific extensions: *.py merge=mergiraf

Impact

  • Current: Unexpected nvim popups when mergiraf can't auto-merge
  • Fixed: Clean failure with conflict markers, user decides when to invoke mergetool

Files to modify:

  • dot_gitconfig.tmpl
  • dot_gitattributes_global (verify mergiraf is registered)
  • README.md (document merge workflow)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions