git-rebase-main

Rebase the current branch onto the default branch with autostash.

Updated Sep 13, 2025
One-click install
npx skills add https://github.com/nobelk/claude-tools --skill git-rebase-main
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: git-rebase-main
Source: https://github.com/nobelk/claude-tools/tree/main/skills/git-rebase-main
Command: npx skills add https://github.com/nobelk/claude-tools --skill git-rebase-main

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

Rebase the current branch onto the default branch to incorporate the latest changes from main or master, helping keep feature work up-to-date and reduce merge conflicts.

Core Features & Use Cases

  • Auto-detects whether the default branch is main or master and rebases onto it.
  • Fetches updates from origin and performs a rebase with --autostash to preserve uncommitted changes.
  • Provides guided steps for resolving conflicts and continuing or aborting the rebase when needed.

Quick Start

Run the bundled script from the repository directory to rebase your current branch onto the default branch.

Frequently Asked Questions about git-rebase-main

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

FAQPage Schema
How do I rebase my current feature branch onto the latest main?

To rebase your current feature branch onto the latest main, you need to fetch updates from origin and apply them using git rebase. This process incorporates the newest changes from the default branch into your current work.

What is the best way to keep a feature branch in sync with the default branch?

Keeping a feature branch in sync with the default branch involves rebasing your current work onto main or master. This aligns your feature work with the latest changes and helps reduce merge conflicts in collaborative workflows.

Does git rebase work with uncommitted changes in my working directory?

Yes, git rebase can work with uncommitted changes by using the --autostash option. This automatically stashes your local modifications before applying the rebase and restores them afterward, preserving your work safely.

How do I handle conflicts when rebasing a branch onto main?

When rebasing a branch onto main and encountering conflicts, you should resolve them manually in your files. After resolving, you can continue or abort the rebase process using guided git commands to restore your branch state.

Can I automatically detect whether the default branch is main or master for a rebase?

Yes, you can automatically detect whether the default branch is main or master before executing a rebase. The detection process checks the repository configuration to identify the correct default branch and rebases onto it.