Skip to content

Allow rebasing a non-current branch without checkout #2790

Open

Description

@sophiadeveloper

Currently, rebasing a branch in SourceGit requires checking it out first, interrupting the current workflow and potentially requiring handling of uncommitted changes.

Please allow rebasing a non-current branch without switching branches. For example, rebase feature/login onto main while staying on develop, even with local changes.

Ideally, if the rebase succeeds without conflicts, only feature/login should be updated, leaving the current branch, working tree, and uncommitted changes untouched.

If conflicts occur, or the operation cannot be performed safely without checkout, it could stop without partial branch updates and offer to switch to feature/login to perform a standard rebase, reusing the existing checkout, local changes handling, and conflict resolution workflows.

SourceGit already uses git replay for conflict detection. Perhaps it could also be used for conflict-free rebases without checkout, where supported. Given its experimental nature and Git version requirements, the existing rebase workflow could remain available as a fallback.

Activity

  1. parkercoates commented on Oct 22, 2026

    @parkercoates

    Is this operation supported by git?

  2. sophiadeveloper commented on Oct 22, 2026

    @sophiadeveloper
    Author

    Yes, it should be possible using git replay, rather than the standard git rebase.

    The Git documentation describes replaying commits onto a new base without modifying the working tree or index, including rebasing a branch without checking it out.

    SourceGit already uses git replay for conflict detection (Rebase.cs). For a successful replay, the target branch reference can also be updated, either directly by git replay in newer Git versions or through git update-ref.

    One consideration is Git version compatibility: git replay requires Git 2.44+, but automatic reference updates were introduced in Git 2.53. Perhaps this feature could simply be enabled for Git 2.53+, similar to SourceGit's existing version check for rebase conflict detection.

    Since git replay is still experimental and has some limitations, perhaps this could be supported for conflict-free cases, keeping the existing checkout-based rebase as a fallback.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions