Skip to content

Conversation

sergeibbb
Copy link
Member

@sergeibbb sergeibbb commented Oct 2, 2025

Description

Resolves ???? (follow-up of #4443)

This is probably waiting for Commit Composer being able to re-compose.

(TODO: probably an issues with the following title should be created: "Add an option to generate commits from all changes on a branch")

(another TODO: be accurate with menu groups. Since the branch is old enough, the related groups could be renamed in main and items be reordered.

image

goes to issue description

Description

<--
Generating new commits from a set of current commits with Commit Composer currently requires picking a commit in the graph and initiating an "AI rebase" for all commits in a branch back to that point. While this is helpful for the specific case where you want to re-generate commits for a selection of commits, this is not very discoverable or intuitive for the case where someone wants to re-compose all commits on a branch.

There should be an option to generate commits for all changes on a branch that is accessible from multiple places:

  • in the context menu when right-clicking a branch ref in the graph
  • as a command palette command
  • from branches in other GitLens views

The "recompose" action in GL is currently called AI Rebase Current Branch onto Commit... (Preview) which only really works for that use case, so we will need a new name for this action - maybe something like Generate New Commits for this Branch (Preview)?

  • "Recompose branch commits" - merge base or merge target? -> closest to the current top
  • "Recompose unpushed commits" only when we have unpushed
  • "Explain Unpushed Changed"
  • Modifies "Explain Branch Changes" - by trying to find user-configured merge base.
image -->

Verification steps

  • test how each new menu item works
  • test that new menu items are visible when and only when there are commits (unpushed or unmerged): both in graph and in Branch View.
  • test how "Explain Branch Changes" works because it's base branch has been modified in getBranchMergeTargetName
  • test how other features that depend on getBranchMergeTargetName
    • Get Branch Contributions Overview
    • Comparison default

Checklist

  • I have followed the guidelines in the Contributing document
  • My changes follow the coding style of this project
  • My changes build without any errors or warnings
  • My changes have been formatted and linted
  • My changes include any required corresponding changes to the documentation (including CHANGELOG.md and README.md)
  • My changes have been rebased and squashed to the minimal number (typically 1) of relevant commits
  • My changes have a descriptive commit message with a short title, including a Fixes $XXX - or Closes #XXX - prefix to auto-close the issue that your PR addresses

@sergeibbb sergeibbb force-pushed the feature/4443-ai-rebase-branch-final branch from 98aa126 to 536e6ad Compare October 2, 2025 12:36
@sergeibbb sergeibbb force-pushed the feature/4443-ai-rebase-on-branch branch from 6426093 to 3a7fd74 Compare October 2, 2025 13:51
@sergeibbb sergeibbb self-assigned this Oct 2, 2025
@sergeibbb sergeibbb force-pushed the feature/4443-ai-rebase-branch-final branch from 536e6ad to 22bf966 Compare October 2, 2025 13:56
@eamodio eamodio added this to the 17.7 milestone Oct 3, 2025
@sergeibbb sergeibbb force-pushed the feature/4443-ai-rebase-branch-final branch from 22bf966 to 58fea79 Compare October 8, 2025 13:24
@sergeibbb sergeibbb force-pushed the feature/4443-ai-rebase-on-branch branch 3 times, most recently from 8109580 to 8095dc5 Compare October 8, 2025 13:45
Introduces new AI-assisted commands to recompose all branch commits
and specifically unpushed commits via the graph webview.

(#4443)
Updates branch context detection to add a '+recomposable' flag for branches that have commits eligible for recomposition, determined by checking recent merge bases against stored targets. Adjusts menu conditions so the AI rebase command is shown only when a branch can be recomposed, preventing unnecessary options for branches without suitable commits.

(#4443, #4522)
This uses the user defined value first and only when it's not set we
fall back to other possible values.
(#4443, #4522)
Introduces AI-powered branch actions ("Recompose" and "Explain")
directly into the branches view, enabling context menu options when
branches are recomposable or have unpushed commits. Refactors and
centralizes branch recomposability detection to ensure consistent logic
across graph and views, improving maintainability and user experience.
Enhances discoverability and workflow integration for AI-assisted Git
operations.

(#4443)
@sergeibbb sergeibbb force-pushed the feature/4443-ai-rebase-branch-final branch from 58fea79 to 303ed6f Compare October 8, 2025 13:49
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