Skip to content

Check parent branch is in sync with remote before finish #99

@alexrinass

Description

@alexrinass

Currently, finish only checks whether the topic branch is in sync with its remote tracking branch. It does not check whether the parent branch (merge target) is up to date. This matches AVH behavior where the parent branch sync status is also verified before proceeding.

Problem

If the parent branch (e.g., develop or main) is behind its remote, the finish merge will succeed locally but the result will be based on a stale parent. The user may then need to reconcile differences when pushing, or worse, overwrite remote changes.

Proposed Behavior

When fetch is enabled and the parent branch has a remote tracking branch:

  1. Fetch the parent branch (already done today)
  2. Compare local parent with its remote tracking branch
  3. If behind or diverged, abort with a clear message telling the user to update the parent branch first
  4. If ahead, proceed (local has more — that's fine)
  5. --force skips this check

Reference

git-flow-avh performs this check. This brings git-flow-next to parity for users who rely on remote-aware workflows.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions