Skip to content

Git conflict resolution helpers #523

@infinisil

Description

@infinisil

Is your feature request related to a problem? Please describe.

When a Git branch is getting formatted, it can cause merge conflicts for other branches. These merge conflicts can in theory be resolved automatically, but that's currently not easily possible.

Describe the solution you'd like

Ideally both of:

  • A CLI command for a git mergetool-compatible mode, implemented like Add scripts/nixfmt-mergetool NixOS/nixfmt#277 (alse has some docs). This is a quick way to resolve merge conflicts, but there's a chance for invalid results.
  • A CLI command to auto-rebase like the one in Nixpkgs, based on git filter-branch. This is a bit more limited, clunkier and slower, but it can't produce invalid results.

These are orthogonal and useful in their own ways.

Describe alternatives you've considered

Implementing it outside treefmt, as linked above. But this doesn't seem ideal because this functionality is generic over formatters, so treefmt would be the ideal place to implement it.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions