On Fri, Jun 24 2022, Erik Cervin Edin wrote: > On Fri, Jun 24, 2022 at 3:20 PM Ævar Arnfjörð Bjarmason > <avarab@xxxxxxxxx> wrote: >> >> Is what you want equivalent to: >> >> # save the "git add -p"'d chunks >> git stash push --staged >> # save the "uncommitted" >> git stash push >> # pop the previously staged >> git stash pop --index stash@{1} >> >> ? > > Never noticed --staged before. > I just tried to > seq 1 3 >> bar > then git add -p to stage with 2 and 3 > followed by a git stash push --staged but that gave me the error > >> error: patch failed: bar:2 >> error: bar: patch does not apply >> Cannot remove worktree changes > > But I'm guessing the command (and approach) work fine if the > staged/unstaged are in different files. Huh! No, it does work when you stage chunks in the same file, I tested this by modifying the top & bottom of our README.md. But we do indeed have that error (which looks like an unrelated bug) if you try to "git stash pust --staged" a hunk when that hunk overlaps with changes that are unstaged.