Add --push flag to upgrade and init commands with reusable git helpers#11298
Merged
Add --push flag to upgrade and init commands with reusable git helpers#11298
Conversation
- Add Push field to UpgradeConfig struct - Add --push flag to upgrade command CLI - Check for clean working directory before upgrade when --push is enabled - Implement commit/pull/push logic after successful compilation - Handle cases where no remote is configured (test environments) - Add tests for --push flag functionality - Update help text with --push example Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
pelikhan
reviewed
Jan 22, 2026
pkg/cli/upgrade_command.go
Outdated
|
|
||
| // Check if there are any changes to commit | ||
| upgradeLog.Print("Checking for modified files") | ||
| cmd := exec.Command("git", "status", "--porcelain") |
Contributor
Author
There was a problem hiding this comment.
Done in commit 32b7e5e. Extracted git operations into reusable helper functions:
hasChangesToCommit()- check for changeshasRemote()- check for remotepullFromRemote()- pull with rebasestageAllChanges()- stage all changespushToRemote()- push to remotecommitAndPushChanges()- orchestrate full workflow
The upgrade command now uses these helpers instead of direct exec.Command calls.
Copilot
AI
changed the title
[WIP] Add --push flag to upgrade command for automatic git operations
Add --push flag to upgrade command for automatic commit/push
Jan 22, 2026
Contributor
|
@copilot refactor "--push" feature into helper in git package and add support to "init" command as well. Use helpers to invoke git |
- Extract git operations into reusable helper functions in git.go: - hasChangesToCommit() - check if there are changes to commit - hasRemote() - check if remote repository exists - pullFromRemote() - pull latest changes with rebase - stageAllChanges() - stage all changes with git add -A - pushToRemote() - push changes to remote - commitAndPushChanges() - orchestrate full commit/push workflow - Refactor upgrade_command.go to use new git helpers - Add --push flag to init command - Update all test files to include new push parameter - Update help text for both commands with --push examples Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Contributor
Author
Done in commit 32b7e5e:
Usage: gh aw init --push # Initialize and auto-commit/push
gh aw upgrade --push # Upgrade and auto-commit/push |
Copilot
AI
changed the title
Add --push flag to upgrade command for automatic commit/push
Add --push flag to upgrade and init commands with reusable git helpers
Jan 22, 2026
This was referenced Jan 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
upgradeandinitcommands now support automatic commit/push workflow via--pushflag. The implementation uses reusable git helper functions for consistency across commands.Changes
Git Helper Functions (pkg/cli/git.go)
git add -ACommands Updated
upgrade command:
init command:
--pushflag supportUsage
Implementation
Created reusable git helper functions in
pkg/cli/git.goto avoid code duplication. Bothupgradeandinitcommands use these helpers for consistent behavior. All git operations now use helper functions instead of directexec.Commandcalls.Original prompt
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.