Skip to content

Conversation

Copy link

Copilot AI commented Jul 8, 2025

This PR adds support for fetching from remote before finishing topic branches, ensuring the latest remote changes are incorporated in the merge.

Changes

  • Command Line Options: Added --fetch and --no-fetch flags to all topic branch finish commands
  • Configuration Support: Added per-branch-type config keys:
    • gitflow.feature.finish.fetch
    • gitflow.release.finish.fetch
    • gitflow.hotfix.finish.fetch
  • Fetch Logic: When enabled, performs git fetch and merges remote changes into target branch before finishing
  • Conflict Handling: Proper merge conflict resolution workflow for remote changes
  • Documentation: Updated README with configuration examples

Usage

# Command line usage
git flow feature finish my-feature --fetch
git flow feature finish my-feature --no-fetch

# Configuration (per branch type)
git config gitflow.feature.finish.fetch true
git config gitflow.release.finish.fetch true
git config gitflow.hotfix.finish.fetch true

Priority

Command line flags override config settings, which override the default (no-fetch).

Testing

Added comprehensive test coverage including:

  • Default behavior (no fetch when not configured)
  • Fetch with command line flags
  • Config-based fetch behavior
  • Command line override of config
  • Remote change incorporation verification
  • Cross-branch type testing (feature, release, hotfix)

All existing tests continue to pass, ensuring backward compatibility.

Example

# Before: only local changes merged
git flow feature finish my-feature

# After: fetch latest remote changes first  
git flow feature finish my-feature --fetch

When fetch is enabled, the tool will:

  1. Checkout the target branch (e.g., develop)
  2. Fetch from the configured remote
  3. Merge remote changes into the target branch
  4. Proceed with normal feature branch merge

This ensures that the finished branch includes the latest changes from the remote repository.

Fixes #18.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits July 8, 2025 17:30
Co-authored-by: alexrinass <116053+alexrinass@users.noreply.github.com>
Co-authored-by: alexrinass <116053+alexrinass@users.noreply.github.com>
Co-authored-by: alexrinass <116053+alexrinass@users.noreply.github.com>
Copilot AI changed the title [WIP] Add fetch option for topic branch finish Add fetch option for topic branch finish Jul 8, 2025
Copilot AI requested a review from alexrinass July 8, 2025 17:45
Copilot finished work on behalf of alexrinass July 8, 2025 17:45
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.

Add fetch option for topic branch finish

2 participants