feat(update): rebase local commits instead of discarding on update - #4142
Closed
GratefulDave wants to merge 1 commit into
Closed
feat(update): rebase local commits instead of discarding on update#4142GratefulDave wants to merge 1 commit into
GratefulDave wants to merge 1 commit into
Conversation
When `hermes update` detects local commits on the branch (ahead of origin/main), the existing flow does `git reset --hard origin/main`, silently destroying the user's local commits. This is destructive for users who cherry-pick or commit local customizations (plugins, hooks, config patches). Changes: - Detect local commits ahead of origin before pulling - When ff-only fails and local commits exist, try `git rebase` to preserve them on top of the new upstream - If rebase hits conflicts, abort cleanly with instructions for manual resolution (never auto-resolve with --strategy-option theirs/ours) - Fall back to `git reset --hard` only when there are no local commits (pure divergence from upstream force-push) - Show notification when local commits are preserved alongside upstream updates
Contributor
Author
|
Closing — needs a fresh rebase against current main. Will resubmit if still relevant. |
This was referenced Jul 29, 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.
Problem
When
hermes updateis run and the local branch has commits ahead oforigin/main(e.g. cherry-picked patches, local plugin hooks, config customizations), the update flow doesgit reset --hard origin/main— silently destroying all local commits.This is especially painful for users who:
Fix
Detect local commits before pulling. When fast-forward fails:
git rebase origin/mainto replay local commits on top of the new upstreamgit reset --hard origin/main(same as before)Before / After
Before:
hermes updatewith 1 local commit → commit silently destroyed, user confusedAfter:
hermes updatewith 1 local commit → rebase preserves it, user sees:Or if conflicts:
Testing