git-imerge
Incrementally merge changes from one branch to another
TLDR
Start imerge-based rebase (checkout the branch to be rebased, first)
Start imerge-based merge (checkout the branch to merge into, first)
Show ASCII diagram of in-progress merge or rebase
Continue imerge operation after resolving conflicts (git add the conflicted files, first)
Wrap up imerge operation, after all conflicts are resolved
Abort imerge operation, and return to the previous branch
SYNOPSIS
git imerge
PARAMETERS
start
Initiates an incremental merge operation with the specified target commit-ish (e.g., branch name, commit hash). This command prepares the repository for the incremental conflict resolution process.
Common options for start:
--rebase (-r): Perform the incremental merge using a rebase strategy where possible, instead of pure merge.
--force (-f): Force the start of a new incremental merge, even if one is already in progress.
--keep-empty-commits (-k): Do not prune empty commits created during the incremental process.
--no-cleanup: Do not perform cleanup after the merge is finished.
continue
Proceeds with the next step of the incremental merge. This is typically run after resolving conflicts for a step and staging the changes, similar to git rebase --continue.
abort
Discards the ongoing incremental merge operation and returns the repository to the state it was in before git imerge start was invoked.
finish
Finalizes the incremental merge, completing the process and creating the merge commit(s) on the current branch.
conflicts
Displays a list of paths that currently have merge conflicts and need resolution.
add
Marks one or more specific file paths as resolved. This tells git-imerge that you have handled the conflicts for these files.
unadd
Unmarks one or more specific file paths, indicating they are no longer considered resolved and require further attention.
resolved
Lists all file paths that git-imerge currently considers resolved for the ongoing merge.
unresolved
Lists all file paths that git-imerge currently considers unresolved for the ongoing merge.
DESCRIPTION
git-imerge is an advanced tool designed to simplify large and complex Git merge operations by breaking them down into smaller, more manageable steps. Instead of resolving all conflicts from a complex merge at once, it guides the user through an incremental process. This approach is particularly valuable in scenarios often referred to as 'merge hell', where a direct git merge would result in overwhelming conflict sets. Internally, git-imerge leverages git bisect to pinpoint commits that introduce conflicts, allowing users to resolve issues one by one, test intermediate states, and ensure a clean, stable merge. This process creates a detailed, traceable history of how conflicts were resolved, offering a robust alternative to manual rebase sequences or large, monolithic merge commits that can obscure resolution steps. It allows for a more controlled and less error-prone resolution of protracted divergence between branches.
CAVEATS
git-imerge is not a core Git command and requires separate installation.
It relies heavily on git bisect for its internal operations, which might add overhead compared to a simple git merge for straightforward cases.
The detailed history created by git-imerge, while useful for auditing conflict resolution, can result in a more complex commit graph with numerous intermediate merge commits.
Users should be comfortable with basic Git operations and conflict resolution before attempting complex git-imerge workflows.
WORKFLOW OVERVIEW
A typical git-imerge workflow involves starting an incremental merge with git imerge start, resolving conflicts in small batches, staging the changes, and then advancing to the next step with git imerge continue. This cycle repeats until all conflicts are resolved, at which point git imerge finish is used to finalize the merge operation. Commands like git imerge add and git imerge unresolved assist in managing the state of conflict resolution.
INTERNAL MECHANISM
At its core, git-imerge intelligently uses git bisect to identify the specific commits that introduce conflicts. It then applies partial merges or rebases to resolve these conflicts incrementally. This systematic approach allows it to build up the final merge commit step-by-step, ensuring that each increment is a resolvable and testable unit of change.
HISTORY
git-imerge was developed by Michael Haggerty to address the significant challenges of 'merge hell' in large, long-running feature branches, particularly in complex projects where traditional git merge often led to unmanageable conflict sets. Its motivation was to provide a robust and systematic way to make such complex merges tractable by breaking them down into smaller, testable steps, offering a more resilient alternative to manual rebase sequences or squashing complex merge histories into a single commit. It gained traction in environments dealing with continuous integration and large codebases where maintaining a clean yet detailed merge history was crucial.
SEE ALSO
git-merge(1), git-rebase(1), git-bisect(1), git-add(1), git-commit(1)