Rebase Until Clean
Automates the process of resolving merge conflicts during a Git rebase operation. This loop continuously attempts to rebase your current branch onto its upstream target, detects and resolves conflicts as they arise, and only exits once the rebase completes successfully without any remaining conflicts.
Goal
Resolve branch conflicts
How to Run
Run this loop in your terminal or supported coding assistant to automatically resolve rebase conflicts until your branch is cleanly rebased.
- 01
Start the loop
Execute the kickoff prompt in your preferred coding assistant or CLI environment.
- 02
Let the agent work
The loop will repeatedly run 'git rebase', detect conflicts, and attempt to resolve them using standard conflict resolution strategies.
- 03
Exit when complete
Once the rebase exits cleanly with no conflicts, the loop will stop and report success.
Workflow Steps
- 01
Initialize rebase
Check current branch status and begin rebase onto upstream branch.
- 02
Check rebase result
Run 'git rebase' command and analyze output for conflict indicators.
- 03
Detect and resolve conflicts
If conflicts are detected, identify conflicting files and apply automated or semi-automated resolution techniques.
- 04
Test changes
After resolving conflicts, verify that the code still functions correctly by running relevant tests or build commands.
- 05
Continue loop
If conflicts remain unresolved or new conflicts appear, continue the loop up to the maximum iteration limit.
- 06
Exit on clean rebase
When rebase completes without errors, signal success and terminate the loop.
Kickoff Prompt
Start the "Rebase Until Clean" loop. Goal: Resolve branch conflicts Max iterations: 10 Between iterations run: git rebase Exit when: Rebase successful You are a Git automation agent. Your task is to perform a rebase of the current branch onto its upstream target and resolve any conflicting changes until the rebase succeeds. Begin by checking the current Git status and initiating the rebase. For each conflict encountered, attempt to resolve it using standard merge conflict resolution practices (accepting ours, theirs, or both). After resolving conflicts, test that the code compiles and passes basic validation. Continue this loop until either the rebase completes successfully or you reach 10 iterations. Do not proceed if there are uncommitted changes in the working directory. Self-pace this loop. After each iteration, run `git rebase` and evaluate the output, and only continue if the exit condition is not met (Rebase successful). Stop when the exit condition passes or 10 iterations are reached. Give a short status update each pass.
Guardrails
hardcoded- ·Ensure a clean working directory before starting (no uncommitted changes).
- ·Back up your branch prior to running this loop if you're concerned about potential data loss.
- ·Do not manually intervene or commit during the loop execution unless prompted.
- ·Use an editor configured for conflict markers (e.g., vim, VSCode) to allow proper conflict resolution.
- ·If more than 10 iterations occur, the loop will exit to prevent infinite loops.
Flow Diagram
Related loops — Git
Git
Conventional Commit Enforcer
This loop ensures all Git commits follow the Conventional Commits specification by using commitlint to validate commit messages. It automatically detects non-compliant commits, suggests fixes, and guides the user through correcting them until all commits pass validation.
Git
Large Commit Splitter
Automatically splits large, monolithic Git commits into smaller, more reviewable units while preserving logical code boundaries and maintaining clean history.
Git
Git Hygiene Loop
This loop helps maintain a clean Git repository by identifying and removing stale or outdated branches that are no longer needed. It ensures your branch list remains manageable and reduces clutter in collaborative environments.