git-rebase

Rebase Git branches onto latest main with autosquash and conflict handling.

3|1|Updated Apr 12, 2026
One-click install
npx skills add https://github.com/Cogni-AI-OU/cogni-ai-agent-skills --skill git-rebase-cogni-ai-ou
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-rebase
Source: https://github.com/Cogni-AI-OU/cogni-ai-agent-skills/tree/main/git-rebase
Command: npx skills add https://github.com/Cogni-AI-OU/cogni-ai-agent-skills --skill git-rebase-cogni-ai-ou

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Git rebase operations can turn a messy commit history into a clean, linear series, but they also risk irreversible mistakes like unwanted history rewrites or editor hangs in automation.

Core Features & Use Cases

  • Interactive rebasing guidance with safety guardrails: Explains when git rebase -i is appropriate and explicitly warns it is forbidden in automated runtime environments due to editor hangs.
  • Non-interactive and scripted rewrite approach: Covers autosquash-based workflows and how to update the rebase todo list via deterministic tooling.
  • Practical conflict and rollback principles: Provides clear advice to avoid conflict panic and use git rebase --abort when things go wrong.
  • Use Case: You have a feature branch with several “work-in-progress” commits and want to squash/fix them into a tidy set before opening a Pull Request while ensuring you don’t disrupt teammates who already pulled the branch.

Quick Start

Use the git-rebase skill to plan and execute a safe rebase by instructing the AI: “Help me update my feature branch by rebasing it onto the latest main safely, using autosquash locally and avoiding any interactive steps in automation.”

Frequently Asked Questions about git-rebase

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I squash work-in-progress commits before opening a pull request?

To squash work-in-progress commits before a pull request, use a non-interactive autosquash rebase to clean up your feature branch history. This safely rewrites intermediate commits into a tidy series without requiring manual editor intervention.

How does git rebase handle conflict resolution during history rewriting?

Git rebase handles conflict resolution by applying commits sequentially and pausing on conflicts. You resolve files manually, stage them, and run git rebase --continue, or use git rebase --abort to rollback and abandon the history rewriting process.

Can I use interactive rebase in automated runtime environments?

You cannot use interactive rebase in automated runtime environments because it opens an editor and causes automation hangs. You must use non-interactive autosquash patterns and deterministic tooling to update the rebase todo list instead.

When should I avoid rebasing a git branch?

You should avoid rebasing shared or public commits because rewriting history disrupts teammates who already pulled the branch. Only rebase local feature branches to update bases or untangle dependency chains safely.

What is the best way to update a feature branch onto the latest main?

The best way to update a feature branch onto the latest main is executing a targeted rebase. This moves your branch base to the latest main commits, creating a linear history while preserving your specific feature changes.

How do I fix a messed up git rebase?

To fix a messed up git rebase, run git rebase --abort to immediately rollback and restore your original branch state. This rollback principle prevents conflict panic and safely cancels the history rewrite.