Skip to content

feat: configurable conflict resolver for rebase conflicts#146

Open
abersnaze wants to merge 2 commits into
msiemens:masterfrom
abersnaze:conflict-resolver
Open

feat: configurable conflict resolver for rebase conflicts#146
abersnaze wants to merge 2 commits into
msiemens:masterfrom
abersnaze:conflict-resolver

Conversation

@abersnaze

Copy link
Copy Markdown

Summary

  • Adds a new git-up.rebase.conflict-resolver config setting that specifies a command to invoke when rebase conflicts occur
  • git-up builds a default prompt with full context (branch names, conflicted files, resolution steps) and substitutes it into the command's {prompt} placeholder
  • If the resolver succeeds, git-up continues to the next branch; if it fails, the repo is left in the conflicted state for manual resolution

Usage

git config git-up.rebase.conflict-resolver "claude -p {prompt}"
# or
git config git-up.rebase.conflict-resolver "aider --message {prompt}"

Changes

  • git_wrapper.py: Added suppress_pop flag to stasher() to prevent auto-unstash when leaving conflicted state; added UnresolvedConflictError exception
  • gitup.py: New setting, _build_resolver_prompt(), _try_resolve_conflicts(), and integration into the rebase path
  • tests/test_conflict_resolver.py: 4 tests covering resolver success, failure, no-resolver fallback, and prompt content

Test plan

  • python -m pytest PyGitUp/tests/test_conflict_resolver.py -xvs — all 4 new tests pass
  • python -m pytest PyGitUp/tests/ -x — full suite (40 tests) passes with no regressions
  • Manual: configure git-up.rebase.conflict-resolver, create a conflict, verify git up invokes the resolver

🤖 Generated with Claude Code

@msiemens msiemens closed this May 20, 2026
@msiemens msiemens reopened this May 20, 2026
@msiemens

Copy link
Copy Markdown
Owner

@abersnaze

Could you rebase this on the latest master branch? I realized that otherwise the test suite will run the OLD tests only (from master) and not executed new tests from your PR.

abersnaze and others added 2 commits May 29, 2026 11:29
When `git up` encounters a rebase conflict, it can now invoke a
configurable command to resolve it automatically. Configure via:

  git config git-up.rebase.conflict-resolver "claude -p {prompt}"

git-up builds a rich default prompt with branch names, conflicted
files, and resolution steps, then substitutes it into the {prompt}
placeholder. Environment variables GITUP_BRANCH, GITUP_TARGET, and
GITUP_REPO_PATH are also set.

If the resolver succeeds (exit 0 and rebase completed), git-up
continues to the next branch. If it fails, the repo is left in the
conflicted state for manual resolution.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@abersnaze abersnaze force-pushed the conflict-resolver branch from ecc5b09 to aa5141e Compare May 29, 2026 18:33
@abersnaze

Copy link
Copy Markdown
Author

Rebased onto latest master!

Also caught a test isolation bug while I was at it — a few existing tests that expect RebaseError were silently passing when git-up.rebase.conflict-resolver is set in global config (the resolver would kick in and resolve the conflict instead of raising). Added gitup.settings['rebase.conflict-resolver'] = None to those tests so they're not sensitive to whatever's in the environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants