Skip to content

fix(merge-into): do not pop an older stash when only untracked files exist - #1289

Merged
spacewander merged 1 commit into
tj:mainfrom
jayhemnani9910:fix/merge-into-untracked-stash
Nov 25, 2026
Merged

spacewander merged 1 commit into
tj:mainfrom
jayhemnani9910:fix/merge-into-untracked-stash

Conversation

@jayhemnani9910

Copy link
Copy Markdown
Contributor

With an untracked file in the working tree and an older entry in the stash list, git merge-into dest applies that older stash to the current branch and drops it.

merge-into stashes when git status --porcelain prints anything, which includes untracked files, but git stash doesn't save untracked files. It saves nothing, and the git stash pop at the end pops whatever stash was already there. The check now uses --untracked-files=no, so it stashes only when git stash has something to save.

Added tests/git-merge-into.bats; it fails without the change. bats ./tests passes.

@spacewander
spacewander merged commit 4929bdf into tj:main Nov 25, 2026
5 checks passed
@spacewander

Copy link
Copy Markdown
Collaborator

@jayhemnani9910
Merged. Thank you!

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