Repository navigation
Autostash local changes by default, rolling back on conflict - #11
Merged
Merged
Conversation
When local changes are in the way of an update, stash them (tracked and untracked), update, and re-apply them with their staged state. If re-applying is not clean, reset to the starting commit, clear any untracked files the failed apply wrote, and re-apply the stash onto its original base, so the repository ends exactly as it was and is reported as dirty. The stash is dropped only once its changes are back, and is looked up by commit so a user's own stash entries are never touched. --no-autostash keeps the old behaviour.
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.
When local edits or untracked files are in the way of an update, pullr now stashes them, updates, and re-applies them on top:
Unlike
git merge --autostash, a conflict never leaves conflict markers behind. If re-applying isn't clean, pullr resets to the starting commit, removes any untracked files the failed apply wrote, and re-applies the stash onto its original base. The repository ends exactly as it was (same commit, same files, same staged and unstaged changes, no stash entry left) and is reported as dirty.--rebase(a diverged branch with local edits is rebased and the edits re-applied).--dry-runshowslocal changes to autostash.git stash drop <sha>isn't supported.--no-autostashrestores the previous behaviour;--autostashis accepted for scripts that want to be explicit.7 new tests, including a check that a conflict leaves no markers, no stash and an identical
git status. I also checked that removing the rollback makes those tests fail. 45 pass on bash 5 and 3.2.