Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 17, 2025

The update command previously performed 3-way merges by default, which could produce unpredictable merge conflicts. This changes the default behavior to override local changes, with merge available via --merge flag.

Changes

  • Added --merge flag to opt into 3-way merge behavior (previous default)
  • Modified updateWorkflow to branch on merge mode:
    if merge {
        // Download base, current, new → 3-way merge
        mergedContent := MergeWorkflowContent(base, current, new, ...)
    } else {
        // Download latest → replace file
        newContent := downloadWorkflowContent(repo, path, latestRef)
        finalContent := updateSourceFieldAndProcessIncludes(newContent, ...)
    }
  • Updated help text to explain default override behavior and merge opt-in
  • Added tests for both modes

Behavior

Mode Command Result
Override (new default) gh aw update Replaces local file with upstream, no conflicts
Merge (opt-in) gh aw update --merge 3-way merge preserving local changes, may conflict

Migration

Users wanting the previous behavior: add --merge to update commands.

Original prompt

Change the "update" command to NOT try to merge by default. The merge mode can be enabled with "--merge". Otherwise, the default behavior is to override local changes.


💡 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 self-assigned this Nov 17, 2025
Copilot AI and others added 2 commits November 17, 2025 23:15
- Added --merge flag to preserve local changes via 3-way merge
- Default behavior now overrides local changes with upstream content
- Updated help text to explain new default behavior
- Added tests for both override and merge modes
- All existing tests pass

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
- All unit tests passing
- Code formatted with make fmt
- Code linted with make lint
- Build successful
- Help text verified and working correctly

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Change default behavior of update command to not merge Change update command to override local changes by default Nov 17, 2025
Copilot AI requested a review from pelikhan November 17, 2025 23:22
@pelikhan pelikhan marked this pull request as ready for review November 17, 2025 23:22
Copilot AI review requested due to automatic review settings November 17, 2025 23:22
@pelikhan pelikhan merged commit fe7706d into main Nov 17, 2025
135 checks passed
@pelikhan pelikhan deleted the copilot/change-update-command-behavior branch November 17, 2025 23:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR changes the default behavior of the update command from performing 3-way merges (which could lead to merge conflicts) to simply overriding local changes with the latest upstream version. Users who want the previous merge behavior can now opt-in using the --merge flag.

Key Changes:

  • Added --merge flag to enable 3-way merge behavior (previous default)
  • Modified update logic to branch between override mode (new default) and merge mode
  • Updated help text and examples to document the new behavior

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pkg/cli/update_command.go Added --merge flag, updated help text, refactored updateWorkflow() to branch between override and merge modes, threading the merge parameter through all update functions
pkg/cli/update_command_test.go Added two new test functions for override and merge modes (though tests lack meaningful assertions)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

github-actions bot added a commit that referenced this pull request Nov 18, 2025
Update documentation to reflect recent changes to the 'gh aw update' command:

- Default behavior now replaces local file with upstream version (no conflicts)
- New --merge flag enables 3-way merge to preserve local changes
- Added git fallback support for public repositories without authentication
- Clarified update modes with table showing default vs merge behavior
- Added authentication section explaining git fallback functionality

Changes documented from:
- PR #4233: Changed update command to override local changes by default
- PR #4238: Added git fallback when GitHub API authentication fails

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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